ChartJS 3.x 如何在图表中放置刻度标签?

ChartJS 3.x How to place tick label inside graph?

ChartJS 3.x 有一种方法可以像附图一样在图表区域内放置刻度标签吗? 我曾尝试在刻度上使用负填充,但我没有成功。

谢谢。

负填充是您的做法。你确定你把 padding 放到了正确的地方吗?

scales: {
          xAxis: {
                type: 'time',
                
                ticks: {
                    display: true,
                    source: 'labels', // get ticks from given labels
                    z: 5, // make sure they are visible
                    padding: -50, // move then ontop of the chart
                },

这是一个JSFiddle.

您可以在这里阅读更多内容:Tick Configuration.