How to Add X axis Padding in chart js Line Graph

邮差的信 提交于 2019-12-25 08:23:21

问题


I drawn a Line graph using chart js. it works well but problem is it will start all the lines from 0 but i need some padding between graph line and axis line it. I need like

I need this Gap ( Red Marked ). How can i achieve this??


回答1:


From the fiddle you provided, A tricky way will be to push in $scope.labels and $scope.data a null in first position:

$scope.labels.unshift('');
$scope.data[0].unshift(null);
$scope.data[1].unshift(null);

A start you had:

And you will have:



来源:https://stackoverflow.com/questions/41932278/how-to-add-x-axis-padding-in-chart-js-line-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!