Highcharts不显示

时间:2017-09-27 17:57:28

标签: highcharts

http://jsfiddle.net/dws18w18/



$('#reg-chart').highcharts({
  title: {
    text: 'Daily Average Registration',
    x: -20
  },
  xAxis: {
    categories: ["2017 JUL 01","2017 JUL 02","2017 JUL 03"]
  },
  yAxis: {
    title: {
      text: ''
    },
    plotLines: [{
      value: 0,
      width: 1,
      color: '#808080'
    }]
  },
  series: [{
    name: 'Users',
    data: ["20","1","61"]
  }]
})

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//code.highcharts.com/highcharts.js"></script>
<div id="reg-chart"></div>
&#13;
&#13;
&#13;

这段代码有什么问题?它为什么没有显示任何内容?此外,我的生产网站上完全相同的问题,在我的本地服务器上正常工作。如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

数据必须是数字而不是字符串

series: [{
    name: 'Users',
    data: ["20","1","61"] // Don't work
}]    
series: [{
    name: 'Users',
    data: [20,1,61] //Works
}]

Link to updated fiddle