在本教程之后,此代码绘制折线图,但没有工具提示.我在这里错过了一些配置选项吗?在教程中有工具提示出现.
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,1)",pointColor: "rgba(151,pointStrokeColor: "#fff",pointHighlightFill: "#fff",pointHighlightStroke: "rgba(151,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 %>" });
解决方法
你使用的是什么版本的chart.js?
我可以确认tooltips work using v1.0.1-beta2
<script src="//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.1-beta.2/Chart.min.js"></script>
但不要工作using v0.2.0.
版本1.0.1-beta2可从cdnjs获得.