$ . ajax ({type : 'post' ,url : '/api/get_history' ,dataType : 'json' ,data : data ,success : function ( data ){
var seriesOptions = [],seriesCounter = 0 ,colors = Highcharts . getOptions (). colors ;createChart = function () {
$ ( '#charts' ). highcharts ( 'StockChart' , {
rangeSelector : {buttons : [{count : 1 ,type : 'hour' ,text : '1h'}, {count : 1 ,type : 'day' ,text : '1d'}, {count : 3 ,type : 'day' ,text : '3d'}, {count : 1 ,type : 'week' ,text : '1w'}, {count : 2 ,type : 'week' ,text : '2w'}],inputEnabled : false ,selected : 1},yAxis : {gridLineWidth : 0},legend : {align : 'center' ,layout : 'horizontal' ,enabled : true ,verticalAlign : 'top'},tooltip : {pointFormat : '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b>' ,valueDecimals : 2},series : seriesOptions});};
$ . each ( data , function ( i , row ){seriesOptions [ i ] = {name : row . name ,data : row . data ,color : colors [ i ]};seriesCounter += 1 ;//if (seriesCounter === names.length) {createChart ();//}});}});==========================================================================data example:[{"data": [[1445398380000, 1424961.0], [1445398380000, 211997.0], ], "name": "kdt_delay_time_sub"}]
highcharts 多条线的js code
最新推荐文章于 2017-05-05 19:05:59 发布