我有一个多线形图使用chart.js版本2.4和angular-chart.js。我想分别用红色和绿色显示这2条线,我不想在线下面填充颜色。我怎么才能做到这一点?
var app=angular.module("app", ["chart.js"]);
app.controller("LineCtrl", function ($scope) {
$scope.labels = ["January", "February", "March", "April", "May", "June", "July","August","September","October","November","December"];
$scope.series = ['one', 'two'];
$scope.data = [
[65, 59, 80, 81, 56, 55, 40, 30, 70, 30, 70, 30],
[28, 48, 40, 19, 86, 27, 90, 35, 70, 62, 75, 60]
];
$scope.onClick = function (points, evt) {
console.log(points, evt);
};
$scope.datasetOverride = [{ yAxisID: 'y-axis-1' }, { yAxisID: 'y-axis-2' }];
$scope.options = {
scales: {
yAxes: [
{
id: 'y-axis-1',
type: 'linear',
display: true,
position: 'left'
},
{
id: 'y-axis-2',
type: 'linear',
display: true,
position: 'right'
}
]
}
};
});
像这样做,
ctrl.datasetOverride = [{
fill: false,
backgroundColor: [
"#ED402A",
"#36A2EB",
"#FFCE56"
]
}, {
fill: false,
backgroundColor: [
"#F0AB05",
"#36A2EB",
"#FFCE56"
]
}
];