Make x label horizontal in ChartJS

后端 未结 2 624
独厮守ぢ
独厮守ぢ 2021-02-19 10:27

\"enter

Drawing a line chart with ChartJS 1.0.1 as above. As it shows, the label in the x-

2条回答
  •  有刺的猬
    2021-02-19 10:34

    try fix the function calculateXLabelRotation in chart.js

    calculateXLabelRotation : function(){
        ...
            //↓↓↓
            this.xLabelRotation = 0;
            //↑↑↑
            if (this.xLabelRotation > 0){
                this.endPoint -= Math.sin(toRadians(this.xLabelRotation))*originalLabelWidth + 3;
            }
        ...
    },
    

提交回复
热议问题