highcahrts动态绑定数据

Posted 有何不可_2016

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了highcahrts动态绑定数据相关的知识,希望对你有一定的参考价值。

<html>  
  <head>  
    <title>Highcharts Example</title>  
    <script language="javascript" type="text/javascript" src="js/jquery.min.js"></script>  
    <script language="javascript" type="text/javascript" src="js/highcharts.js"></script>  
    <script language="javascript" type="text/javascript" src="js/exporting.js"></script>  
    <script type="text/javascript">  
      var chart;
      $(document).ready(function() {
        var options = {
          chart: {
            renderTo: ‘container‘,
            type: ‘line‘,
            marginRight: 130,
            marginBottom: 25
          },
          title: {
            text: ‘每天的分布情况‘,
            x: -20 //center
          },
          xAxis: {
            categories: [‘0‘, ‘1‘, ‘2‘, ‘3‘,‘4‘,‘5‘,‘6‘,‘7‘,‘8‘,‘9‘]
          },
          yAxis: {
            title: {
              text: ‘Y轴‘
            },
            plotLines: [{
              value: 0,
              width: 1,
              color: ‘#808080‘
            }]
          },
          tooltip: {
            formatter: function() {
              return ‘<b>‘+ this.series.name +‘</b><br/>‘ + this.x +‘: ‘+ this.y ;
            }
          },
          legend: {
            layout: ‘vertical‘,
            align: ‘right‘,
            verticalAlign: ‘top‘,
            x: -10,
            y: 100,
            borderWidth: 0
          },
          series: []
        }
        options.series = new Array();
        var i;
        for(i=0;i<10;i++)
        {
           options.series[i] = new Object();
           options.series[i].name = ‘Sample‘+i;
           options.series[i].data = new Array(0+i, 1+i, 2+i, 3+i,4+i,5+i,6+i,7+i,8+i,9+i);
         }
       chart = new Highcharts.Chart(options);
     });
  </script>
  </head>  
 <body>  
   <div id="container" style="width: 800px;height: 400px"></div>  
 </body>  
</html>  

以上是关于highcahrts动态绑定数据的主要内容,如果未能解决你的问题,请参考以下文章

动态绑定剑道网格数据源绑定到指令

动态数据绑定之监听对象变化

Vue.js 动态绑定class

HighChat动态绑定数据 数据后台绑定

数据绑定动态数据

05《Vue 入门教程》Vue 动态样式绑定