我正在做一些研究,我想知道是否可以像 Chart.js 中那样制作自定义工具提示,但我找不到任何东西。我想在我的工具提示中添加一些 css!我正在使用 Angular5。
尝试将其添加到您的图表选项:
public barChartOptions: ChartOptions = {
...
tooltips: {
backgroundColor: 'rgba(255,255,0,0.5)',
bodyFontColor: 'blue',
borderColor: '#0ff',
borderWidth: 5,
caretPadding: 10,
displayColors: false,
enabled: true,
intersect: true,
mode: 'x',
titleFontColor: '#333',
titleMarginBottom: 10,
xPadding: 20,
yPadding: 15,
// If you want to custom the value
callbacks: {
label: function (tooltipItem, data) {
const datasetLabel = data.datasets[tooltipItem.datasetIndex].label || '';
return datasetLabel + ': $' + tooltipItem.yLabel;
}
}
},
}
另请参阅这个答案:https://stackoverflow.com/a/54890570 https://stackoverflow.com/a/54890570
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)