Make x label horizontal in ChartJS

后端 未结 2 788
终归单人心
终归单人心 2021-02-19 10:29

\"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:31

    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;
            }
        ...
    },
    

提交回复
热议问题