我在谷歌搜索过,无法找到如何在折线图中显示工具提示。我正在使用angular-chart.js。
$scope.labels = ["January", "February", "March", "April", "May", "June", "July"];
$scope.series = ['Series A', 'Series B'];
$scope.data = [
[65, 59, 80, 81, 56, 55, 40],
[28, 48, 40, 19, 86, 27, 90]
];
$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'
}
]
}
};
});
HTML
<canvas id="line" class="chart chart-line" chart-data="data"
chart-labels="labels" chart-series="series" chart-options="options"
chart-dataset-override="datasetOverride" chart-click="onClick">
</canvas>
我正在搜索类似的this,它会在工具提示上显示百分比。
我尝试过以下选项。(在angular-js问题中找到)。但它不起作用。
var options = {
scaleShowLabelBackdrop : true,
scaleShowLabels : true,
scaleBeginAtZero : true,
scaleLabel : "Percent",
multiTooltipTemplate: "10% achieved"
}