如何在图表js折线图中添加X轴填充

时间:2017-01-30 09:16:00

标签: javascript jquery angularjs html5 chart.js

我使用图表js绘制了一个折线图。它运作良好,但问题是它将从0开始所有行,但我需要在图线和轴线之间进行一些填充。我需要像

enter image description here

我需要这个差距(红色标记)。我怎样才能实现这个目标?

1 个答案:

答案 0 :(得分:0)

从您提供的the fiddle开始,一个棘手的方法是将$scope.labels$scope.data null推入第一位:

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

你有一个开始:

enter image description here

你将拥有:

enter image description here