将选项传递给ChartJS对象有什么问题?为什么这不起作用?

时间:2016-11-24 15:50:49

标签: javascript chart.js

所以,我正在使用ChartJS的教程,我可以很好地创建折线图,但是当我将鼠标悬停在点上时,它不会显示数据。当我尝试使用options数组添加标题时,它不起作用。这是我的代码。

var buyerData = {
    labels : ["January","February","March","April","May","June"],
    datasets : [
        {
            fillColor : "rgba(172,194,132,0.4)",
            strokeColor : "#ACC26D",
            pointColor : "#fff",
            pointStrokeColor : "#9DB86D",
            data : [203,156,99,251,305,247]
        }
    ]
  } 

  var options = {
    title: {
        display: true,
        text: 'Test'
    },
    responsive: true,
    animation: true });
  var buyers = document.getElementById('buyers').getContext('2d');
  new Chart(buyers).Line(buyerData, options);

0 个答案:

没有答案