Я работаю над созданием простой линейной диаграммы, используя angular-chart.js (версия 1.1.1), и я хотел бы установить xScalePaddingLeft picture или получить значение xScalePaddingLeft.Я мог найти, как это сделать, только в chart.js.
Как мне это сделать в angular-chart.js?Есть предложения?
<div ng-controller="LineCtrl as ctrl">
<canvas id="line"
class="chart chart-line"
chart-data="ctrl.data"
chart-labels="ctrl.labels"
chart-options="ctrl.options"
chart-colors = "ctrl.colors"
chart-series="ctrl.series"
chart-click="onClick">
</canvas>
</div>
js
var app = angular.module("app", ["chart.js"]);
app.config(['ChartJsProvider', function(ChartJsProvider) {
ChartJsProvider.setOptions({
chartColors: ["#F7464A", "#46BFBD"],
responsive: true,
mantainAspectRatio: false
});
ChartJsProvider.setOptions('line', {
showLines: true
});
}]);
app.controller("LineCtrl", function ($scope) {
var $ctrl = this;
$ctrl.labels = [];
$ctrl.data = [[], [], null];
$ctrl.series = [];
$ctrl.colors = [];
$ctrl.options = {};
var arrLabels = new Array();
var arrLine1 = new Array();
var arrLine2 = new Array();
var arrToday = new Array();
var today;
today = "06.11.2018";
arrLabels = ["29.10.2018","30.10.2018","31.10.2018","01.11.2018","02.11.2018", "03.11.2018","04.11.2018","05.11.2018","06.11.2018","07.11.2018", "08.11.2018","09.11.2018","10.11.2018","11.11.2018"];
arrLine1 = [80.0,72.0,64.0,56.0,48.0,40.0,40.0,40.0,32.0,24.0,16.0,8.0,0.0,0.0];
arrLine2 = [7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0,7.0];
$ctrl.labels = arrLabels;
$ctrl.data = [arrLine1, arrLine2, arrToday];
$ctrl.series = ['Line1', 'Line2', 'Today'];
$ctrl.colors = ["#F0000", "#0000FF", "#FF0000"];
$ctrl.options = {
legend: { display: true },
annotation: {
annotations: [{
type: 'line',
mode: 'vertical',
scaleID: 'x-axis-0',
value: today,
borderColor: "#FF0000",
borderWidth: 2
}]
},
elements:{
line: {
fill:false,
tension: false
}
}
};
});
plunker