亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

jquer 獲取json數據,并且用 highcharts 實現展現

發布時間:2020-06-29 01:34:24 來源:網絡 閱讀:1005 作者:tianshuai369 欄目:web開發

json數據格式如下:

{

   "value": [
        23,
        4,
	24,
	95,
	27,
	35,
	93,
	63,
	75,
	17,
	13,
	93,
	54,
	71,
	61,
	14,
	13,
        14,
        29
    ]

  

}

需要highcharts的dark-blue.js文件

html文件格式如下:

<!doctype html>
<html lang="en">
<head>
  <script type="text/javascript" src="http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
  <script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
  <script type="text/javascript" src="http://cdn.hcharts.cn/highcharts/exporting.js"></script>
  <script type="text/javascript" src="dark-blue.js"></script>
  <script>
  $(document).ready(function() {
    $.getJSON('http://1.1.1.1:800/1.json', { }, function (json_data) {
    //左側Javascript代碼
 $(function () {                                                                     
    $(document).ready(function() {                                                  
        Highcharts.setOptions({                                                     
            global: {                                                               
                useUTC: false                                                       
            }                                                                       
        });                                                                         
                                                                                    
        var chart;                                                                  
        $('#container').highcharts({                                                
            chart: {                                                                
                type: 'spline',                                                     
                animation: Highcharts.svg,             
                marginRight: 10,                                                    
                events: {                                                           
                                                                           
                }                                                                   
            },                                                                      
            title: {                                                                
                text: '流量圖'                                            
            },                                                                      
            xAxis: {   
    title: {                                                            
                    text: '時間'                                                   
                },
                type: 'datetime',                                                   
                tickPixelInterval: 150                                              
            },
   credits: {          
    enabled:false
   },  
            yAxis: {                                                                
                title: {                                                            
                    text: '單位/M'                                                   
                },                                                                  
                plotLines: [{                                                       
                    value: 0,                                                       
                    width: 1,                                                       
                    color: '#808080'                                                
                }]                                                                  
            },                                                                      
            tooltip: {                                                              
                formatter: function() {                                             
                        return '<b>'+ this.series.name +'</b><br/>'+                
                        Highcharts.dateFormat("時間:"+ '%m-%d %H:%M:%S', this.x) +'<br/>'+
                        "數據:" + Highcharts.numberFormat(this.y, 2);                         
                }                                                                   
            },   
   
            legend: {                                                               
                enabled: false                                                      
            },                                                                      
            exporting: {                                                            
                enabled: false                                                      
            },                                                                      
            series: [{                                                              
                name: '實時數據',                                                
                data: (function() {  
                    // generate an array of random data                             
                    var data = [],                                                  
                        time = (new Date()).getTime(),                            
                      length=((json_data.value).length)+1;
      
     $.each(json_data.value, function(i, value) {      
         data.push({                                                 
                            x: time - length * 1000, 
                            y: value                                       
                        }); 
      length--;      
     });                                                                  
                    return data;                                                    
                })()                                                                
            }]                                                                      
        });                                                                         
    });                                                                             
                                                                                    
});  
}); 
});                                                                                    
  </script>
</head>
<body>
  <div id="container" ></div>
</body>
</html>

最終展現效果如下:

jquer 獲取json數據,并且用 highcharts 實現展現

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

江孜县| 英吉沙县| 华池县| 通州市| 浦东新区| 芮城县| 巴彦县| 扎囊县| 嘉黎县| 望城县| 葫芦岛市| 治多县| 嵊州市| 徐闻县| 阿荣旗| 邵东县| 水富县| 镶黄旗| 辽中县| 中方县| 屏山县| 玛沁县| 合水县| 和政县| 石河子市| 左云县| 抚宁县| 隆尧县| 辛集市| 民勤县| 天峻县| 灵川县| 靖江市| 金昌市| 肥西县| 玉田县| 咸阳市| 上高县| 佛坪县| 蚌埠市| 尉氏县|