繼教程之後,此代碼繪製折線圖,但沒有提示。我在這裏錯過了一些配置選項嗎?在教程中出現了工具提示。如何在Chart.js中顯示工具提示?
var chartData = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My Second dataset",
fillColor: "rgba(151,187,205,0.2)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "rgba(151,187,205,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(151,187,205,1)",
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
var ctx = document.getElementById("chart").getContext("2d");
var myNewChart = new Chart(ctx).Line(chartData, {
showTooltip: true,
tooltipTemplate: "<%= value %>"
});
證實,v0.2.0是目前可用的版本上的NuGet(26/09/14 ),典型的... –
是的,我抓住它與涼亭。我的代碼在從CDN加載Chart.js後工作 –
我通過Nuget得到它,並有同樣的問題。我必須從https://github.com/nnnick/Chart.js獲取最新版本。 –