admin管理员组文章数量:1336084
I am using Chart.js and am struggling to figure out how to overwrite the defaults when the user hovers over a data point on the graph. Currently when I hover the mouse over a data point the X and Y coordinates appear. Is there a way to change what is displayed.
Here is the for loop I am using for to give each data point its value.
for (var j = 0; j < sub_array_scores.length; j++) {
var data = {
x: new Date(sub_array_dates[j]),
y: sub_array_scores[j],
r: 5
};
coordinates.push(data);
}
and here is an image of what appears when I hover over a point in the graph How would I change that to say instead your score is: Y
I am using Chart.js and am struggling to figure out how to overwrite the defaults when the user hovers over a data point on the graph. Currently when I hover the mouse over a data point the X and Y coordinates appear. Is there a way to change what is displayed.
Here is the for loop I am using for to give each data point its value.
for (var j = 0; j < sub_array_scores.length; j++) {
var data = {
x: new Date(sub_array_dates[j]),
y: sub_array_scores[j],
r: 5
};
coordinates.push(data);
}
and here is an image of what appears when I hover over a point in the graph How would I change that to say instead your score is: Y
Share asked Feb 16, 2018 at 22:20 AaronAaron 4,50021 gold badges92 silver badges151 bronze badges 1- Would it be possible for you to post a minimal example via JSFiddle? – NickyTheWrench Commented Feb 16, 2018 at 22:33
1 Answer
Reset to default 6are custom Tooltips what you're looking for?
http://www.chartjs/docs/latest/configuration/tooltip.html
本文标签: javascriptChartjs change the label for each data point on a chartStack Overflow
版权声明:本文标题:javascript - Chart.js change the label for each data point on a chart - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742404172a2468479.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论