有沒有辦法讓人們可以禁用Chart JS Chart上的一個數據集上的工具提示,並將工具提示留在其他數據集中。這裏是我當前的代碼:僅在一個數據集上禁用chartJS工具提示
var data = {
labels: [' . $labels . '],
datasets: [
{
label: "Portfolio Performance",
fillColor: "rgba(0,0,220,0.2)",
strokeColor: "rgba(0,220,220,1)",
pointColor: "rgba(0,0,0,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [' . $values . ']
},
{
label: "Portfolio Expendature",
fillColor: "rgba(0,0,220,0)",
strokeColor: "rgba(0,0,0,1)",
pointColor: "rgba(0,0,0,0)",
pointStrokeColor: "rgba(0,0,220,0)",
pointHighlightFill: "rgba(0,0,220,0)",
pointHighlightStroke: "rgba(220,220,220,0)",
data: [4450000,4450000,4450000,4450000,4450000]
}
]
};
var option = {
tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= \'£\' + FormatNumberBy3(Number(value).toFixed(2), \'.\' , \',\') %>",
maintainAspectRatio: false,
bezierCurve: false,
responsive: true,
scaleLabel: "<%= \'£\' + FormatNumberBy3(Number(value), \'.\' , \',\') %>"
};
var ctx = document.getElementById("graph").getContext("2d");
var myLineChart = new Chart(ctx).Line(data, option);
非常感謝您! – WhittyProgramming