我找不到选项(ractroptions(在我的图表中使用chart.js在splunk环境中显示图例。
这对我不起作用:
options: {
legend: {
display: true,
labels: {
fontColor: 'rgb(255, 99, 132)'
}
}
}
我的代码如下:
var radarChartData = {
labels: ["Python", "DevOps", "BI"],
datasets: [{
label: 'Dataset 1',
fill: true,
fillColor: "rgba(151,187,205,0.5)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
data: testData[0]
}, {
label: 'Dataset 2',
fill: true,
fillColor: "rgba(101,197,205,0.5)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
data: testData[1]
}]
}
return radarChartData;
},
// Override this method to put the Splunk data into the view
updateView: function(viz, radarData) {
// Set radar chart options
var radarOptions = {
scaleOverride: true,
scaleSteps: 10,
scaleStepWidth: 1,
scaleStartValue: 0,
scaleShowLabels: true,
datasetFill: true,
scaleShowLabelBackdrop: true,
};
// Create the radar chart
var myRadar = new Chart(document.getElementById(mychartid).getContext("2d")).Radar(radarData, radarOptions); /*radarData,radarOption*/
}
});
请帮忙。如何称为显示传说的选项。legend: true
和legendDisplay:true
都不适合我。
我已经通过将图表JS升级到最新版本来解决。