如何在chart.js图形中添加工具提示
How to add tooltips to chart.js graph
我正在做一个web应用程序,我最近用chart.js交换了谷歌图表,因为它在视觉上更吸引人。然而,我的一个损失是我不能再得到数据点以上的工具提示。我想知道是否有人知道这是如何做到的,因为我是一个javascript新手。下面是图形和设置的代码:
var data = {
labels : graphData[0],
datasets : [
{
fillColor : "rgba(200,160,100,0.5)",
strokeColor : "rgba(80,240,70,1)",
pointColor : "rgba(80,240,70,1)",
pointStrokeColor : "#fff",
data : graphData[3]
},
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : graphData[1]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : graphData[2]
}
]
};
var options = {
scaleShowGridLines : true,
scaleShowLabels : true,
animationSteps : 150,
scaleOverride: true,
scaleSteps : Math.max.apply(Math, graphData[3]),
scaleStepWidth : 1,
scaleStartValue : 1
};
var ctx = document.getElementById("chart_div").getContext("2d");
ctx.canvas.width = Math.max(graphData[0].length * 60, 600);
var myNewChart = new Chart(ctx).Line(data,options);
$('#chart_area').fadeIn();
$('html, body').animate({
scrollTop: $("#picture_area").offset().top
}, 1000);
var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx).Line(lineChartData, {
responsive: true,
showTooltips: true,
multiTooltipTemplate: "<%= value %>",
});
相关文章:
- 高图表 - 是否可以为每个系列添加工具提示格式化程序
- HTML5/Bootstrap-如何为引导程序图标添加工具提示
- 如何在d3js垂直分组条形图中添加工具提示
- 如何使用d3js为循环中的圆环图添加工具提示
- 在d3.js地图中添加工具提示
- D3.js如何使用折线图在我的图例中添加工具提示
- 使用 dojo 将鼠标悬停在动态下拉列表选择上时添加工具提示
- 在 Dojo Select 中添加工具提示
- 从 XML 列表填充的 ASP 下拉列表如何添加工具提示
- 在jQuery中添加工具提示
- 如何使用dojocharts为指标绘图添加工具提示
- 如何使用bootstrap或jquery添加工具提示以在下拉列表中显示所选值
- 在 data.feature 对象上添加工具提示,就像我们可以对标记所做的那样
- 在javascript图形中添加工具提示
- nvd3向多条形图添加工具提示
- 如何使用C#向方框图添加工具提示
- 为html.dropdownlist添加工具提示
- 在进度条引导中添加工具提示
- 在D3js甘特图中添加工具提示
- 如何在chart.js图形中添加工具提示