gpt4 book ai didi

javascript - 谷歌折线图上的额外直线

转载 作者:太空宇宙 更新时间:2023-11-04 15:47:50 25 4
gpt4 key购买 nike

我编写了一些 js 代码来从 json 输入绘制 google 可视化折线图

折线图是用接触曲线末端的额外直线绘制的,如下图所示。

当前折线图:

Line charts with extra straight lines

没有直线的 future 折线图:

To-be line graph without straight lines写了下面的js代码:

google.charts.load('current', {

callback : function() {

drawChart();

$(window).resize(drawChart);

},

packages : [ 'corechart' ]

});

function drawChart() {

var json = jsonData[0];

var data = new google.visualization.DataTable();

data.addColumn('datetime',json[0].splunkConfig.parameter1);
data.addColumn('number', json[0].splunkConfig.parameter2);
data.addColumn('number', json[0].splunkConfig.parameter3);


$.each(json[0].splunkConfigs, function(i, splunkConfigs) {
var result = [];
data.addRow([ new Date(splunkConfigs.parameter1),
Number(splunkConfigs.parameter2), Number(splunkConfigs.parameter3) ]);
});

var options = {
hAxis : {
title : 'Time',
textStyle : {
color : '#01579b',
fontSize : 20,
fontName : 'Arial',
bold : true,
italic : true
},
titleTextStyle : {
color : '#01579b',
fontSize : 16,
fontName : 'Arial',
bold : false,
italic : true
}
},
vAxis : {
title : 'Count',
textStyle : {
color : '#1a237e',
fontSize : 24,
bold : true
},
titleTextStyle : {
color : '#1a237e',
fontSize : 24,
bold : true
}
},
colors : [ '#a52714', '#097138' ],
title : 'Sample json line chart'
};

// ...etc. Rest of your code comes here, or is called from here.
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.LineChart(document
.getElementById('chart_div'));

chart.draw(data, {
width : 1400,
height : 650
});

}

示例数据:

[[{"splunkConfig":{"id":0,"parameter1":"_time","parameter2":"Peak (second)","parameter3":"TPS (ave/min)","parameter4":null,"checklists":null},"splunkConfigs":[{"id":0,"parameter1":"2017-04-14 07:59:00","parameter2":"250","parameter3":"198.575000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:00:00","parameter2":"281","parameter3":"208.000000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:01:00","parameter2":"283","parameter3":"232.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:02:00","parameter2":"305","parameter3":"232.516667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:03:00","parameter2":"294","parameter3":"227.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:04:00","parameter2":"281","parameter3":"219.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:05:00","parameter2":"311","parameter3":"233.533333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:06:00","parameter2":"280","parameter3":"222.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:07:00","parameter2":"294","parameter3":"216.216667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:08:00","parameter2":"258","parameter3":"208.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:09:00","parameter2":"269","parameter3":"214.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:10:00","parameter2":"259","parameter3":"208.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:11:00","parameter2":"272","parameter3":"219.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:12:00","parameter2":"284","parameter3":"222.850000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:13:00","parameter2":"276","parameter3":"221.133333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:14:00","parameter2":"274","parameter3":"228.066667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:15:00","parameter2":"299","parameter3":"231.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:16:00","parameter2":"279","parameter3":"216.250000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:17:00","parameter2":"283","parameter3":"215.966667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:18:00","parameter2":"291","parameter3":"227.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:19:00","parameter2":"288","parameter3":"231.916667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:20:00","parameter2":"285","parameter3":"226.650000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:21:00","parameter2":"281","parameter3":"218.733333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:22:00","parameter2":"325","parameter3":"218.566667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:23:00","parameter2":"343","parameter3":"234.700000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:24:00","parameter2":"373","parameter3":"246.416667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:25:00","parameter2":"332","parameter3":"224.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:26:00","parameter2":"328","parameter3":"237.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:27:00","parameter2":"305","parameter3":"228.616667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:28:00","parameter2":"308","parameter3":"222.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:29:00","parameter2":"274","parameter3":"216.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:30:00","parameter2":"268","parameter3":"218.866667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:31:00","parameter2":"283","parameter3":"224.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:32:00","parameter2":"346","parameter3":"244.800000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:33:00","parameter2":"294","parameter3":"233.683333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:34:00","parameter2":"308","parameter3":"238.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:35:00","parameter2":"289","parameter3":"210.150000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:36:00","parameter2":"288","parameter3":"229.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:37:00","parameter2":"308","parameter3":"235.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:38:00","parameter2":"304","parameter3":"243.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:39:00","parameter2":"320","parameter3":"241.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:40:00","parameter2":"282","parameter3":"224.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:41:00","parameter2":"290","parameter3":"225.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:42:00","parameter2":"337","parameter3":"251.183333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:43:00","parameter2":"294","parameter3":"233.266667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:44:00","parameter2":"303","parameter3":"230.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:45:00","parameter2":"317","parameter3":"233.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:46:00","parameter2":"298","parameter3":"227.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:47:00","parameter2":"298","parameter3":"225.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:48:00","parameter2":"259","parameter3":"214.233333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:49:00","parameter2":"323","parameter3":"227.883333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:50:00","parameter2":"284","parameter3":"236.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:51:00","parameter2":"306","parameter3":"240.933333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:52:00","parameter2":"301","parameter3":"233.750000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:53:00","parameter2":"324","parameter3":"244.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:54:00","parameter2":"293","parameter3":"250.433333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:55:00","parameter2":"301","parameter3":"247.016667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:56:00","parameter2":"293","parameter3":"221.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:57:00","parameter2":"308","parameter3":"239.300000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:58:00","parameter2":"266","parameter3":"222.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:59:00","parameter2":"260","parameter3":"199.400000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 07:59:00","parameter2":"250","parameter3":"198.575000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:00:00","parameter2":"281","parameter3":"208.000000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:01:00","parameter2":"283","parameter3":"232.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:02:00","parameter2":"305","parameter3":"232.516667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:03:00","parameter2":"294","parameter3":"227.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:04:00","parameter2":"281","parameter3":"219.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:05:00","parameter2":"311","parameter3":"233.533333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:06:00","parameter2":"280","parameter3":"222.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:07:00","parameter2":"294","parameter3":"216.216667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:08:00","parameter2":"258","parameter3":"208.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:09:00","parameter2":"269","parameter3":"214.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:10:00","parameter2":"259","parameter3":"208.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:11:00","parameter2":"272","parameter3":"219.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:12:00","parameter2":"284","parameter3":"222.850000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:13:00","parameter2":"276","parameter3":"221.133333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:14:00","parameter2":"274","parameter3":"228.066667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:15:00","parameter2":"299","parameter3":"231.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:16:00","parameter2":"279","parameter3":"216.250000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:17:00","parameter2":"283","parameter3":"215.966667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:18:00","parameter2":"291","parameter3":"227.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:19:00","parameter2":"288","parameter3":"231.916667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:20:00","parameter2":"285","parameter3":"226.650000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:21:00","parameter2":"281","parameter3":"218.733333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:22:00","parameter2":"325","parameter3":"218.566667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:23:00","parameter2":"343","parameter3":"234.700000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:24:00","parameter2":"373","parameter3":"246.416667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:25:00","parameter2":"332","parameter3":"224.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:26:00","parameter2":"328","parameter3":"237.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:27:00","parameter2":"305","parameter3":"228.616667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:28:00","parameter2":"308","parameter3":"222.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:29:00","parameter2":"274","parameter3":"216.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:30:00","parameter2":"268","parameter3":"218.866667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:31:00","parameter2":"283","parameter3":"224.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:32:00","parameter2":"346","parameter3":"244.800000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:33:00","parameter2":"294","parameter3":"233.683333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:34:00","parameter2":"308","parameter3":"238.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:35:00","parameter2":"289","parameter3":"210.150000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:36:00","parameter2":"288","parameter3":"229.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:37:00","parameter2":"308","parameter3":"235.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:38:00","parameter2":"304","parameter3":"243.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:39:00","parameter2":"320","parameter3":"241.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:40:00","parameter2":"282","parameter3":"224.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:41:00","parameter2":"290","parameter3":"225.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:42:00","parameter2":"337","parameter3":"251.183333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:43:00","parameter2":"294","parameter3":"233.266667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:44:00","parameter2":"303","parameter3":"230.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:45:00","parameter2":"317","parameter3":"233.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:46:00","parameter2":"298","parameter3":"227.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:47:00","parameter2":"298","parameter3":"225.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:48:00","parameter2":"259","parameter3":"214.233333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:49:00","parameter2":"323","parameter3":"227.883333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:50:00","parameter2":"284","parameter3":"236.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:51:00","parameter2":"306","parameter3":"240.933333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:52:00","parameter2":"301","parameter3":"233.750000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:53:00","parameter2":"324","parameter3":"244.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:54:00","parameter2":"293","parameter3":"250.433333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:55:00","parameter2":"301","parameter3":"247.016667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:56:00","parameter2":"293","parameter3":"221.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:57:00","parameter2":"308","parameter3":"239.300000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:58:00","parameter2":"266","parameter3":"222.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:59:00","parameter2":"260","parameter3":"199.400000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 07:59:00","parameter2":"250","parameter3":"198.575000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:00:00","parameter2":"281","parameter3":"208.000000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:01:00","parameter2":"283","parameter3":"232.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:02:00","parameter2":"305","parameter3":"232.516667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:03:00","parameter2":"294","parameter3":"227.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:04:00","parameter2":"281","parameter3":"219.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:05:00","parameter2":"311","parameter3":"233.533333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:06:00","parameter2":"280","parameter3":"222.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:07:00","parameter2":"294","parameter3":"216.216667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:08:00","parameter2":"258","parameter3":"208.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:09:00","parameter2":"269","parameter3":"214.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:10:00","parameter2":"259","parameter3":"208.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:11:00","parameter2":"272","parameter3":"219.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:12:00","parameter2":"284","parameter3":"222.850000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:13:00","parameter2":"276","parameter3":"221.133333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:14:00","parameter2":"274","parameter3":"228.066667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:15:00","parameter2":"299","parameter3":"231.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:16:00","parameter2":"279","parameter3":"216.250000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:17:00","parameter2":"283","parameter3":"215.966667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:18:00","parameter2":"291","parameter3":"227.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:19:00","parameter2":"288","parameter3":"231.916667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:20:00","parameter2":"285","parameter3":"226.650000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:21:00","parameter2":"281","parameter3":"218.733333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:22:00","parameter2":"325","parameter3":"218.566667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:23:00","parameter2":"343","parameter3":"234.700000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:24:00","parameter2":"373","parameter3":"246.416667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:25:00","parameter2":"332","parameter3":"224.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:26:00","parameter2":"328","parameter3":"237.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:27:00","parameter2":"305","parameter3":"228.616667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:28:00","parameter2":"308","parameter3":"222.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:29:00","parameter2":"274","parameter3":"216.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:30:00","parameter2":"268","parameter3":"218.866667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:31:00","parameter2":"283","parameter3":"224.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:32:00","parameter2":"346","parameter3":"244.800000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:33:00","parameter2":"294","parameter3":"233.683333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:34:00","parameter2":"308","parameter3":"238.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:35:00","parameter2":"289","parameter3":"210.150000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:36:00","parameter2":"288","parameter3":"229.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:37:00","parameter2":"308","parameter3":"235.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:38:00","parameter2":"304","parameter3":"243.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:39:00","parameter2":"320","parameter3":"241.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:40:00","parameter2":"282","parameter3":"224.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:41:00","parameter2":"290","parameter3":"225.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:42:00","parameter2":"337","parameter3":"251.183333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:43:00","parameter2":"294","parameter3":"233.266667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:44:00","parameter2":"303","parameter3":"230.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:45:00","parameter2":"317","parameter3":"233.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:46:00","parameter2":"298","parameter3":"227.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:47:00","parameter2":"298","parameter3":"225.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:48:00","parameter2":"259","parameter3":"214.233333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:49:00","parameter2":"323","parameter3":"227.883333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:50:00","parameter2":"284","parameter3":"236.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:51:00","parameter2":"306","parameter3":"240.933333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:52:00","parameter2":"301","parameter3":"233.750000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:53:00","parameter2":"324","parameter3":"244.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:54:00","parameter2":"293","parameter3":"250.433333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:55:00","parameter2":"301","parameter3":"247.016667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:56:00","parameter2":"293","parameter3":"221.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:57:00","parameter2":"308","parameter3":"239.300000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:58:00","parameter2":"266","parameter3":"222.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:59:00","parameter2":"260","parameter3":"199.400000","parameter4":null,"checklists":null}],"countOfParams":3}]]

已尝试使用多个 javascript datetime 选项,但没有一个起作用..:(

如果您可以帮助/指导我删除直线,那就太好了。

提前致谢。

最佳答案

只需在绘制之前对数据进行排序...

// sort data before drawing
data.sort([{column: 0}]);

请参阅以下工作片段...

google.charts.load('current', {
callback : function() {
drawChart();
$(window).resize(drawChart);
},
packages : [ 'corechart' ]
});

function drawChart() {
var json = [[{"splunkConfig":{"id":0,"parameter1":"_time","parameter2":"Peak (second)","parameter3":"TPS (ave/min)","parameter4":null,"checklists":null},"splunkConfigs":[{"id":0,"parameter1":"2017-04-14 07:59:00","parameter2":"250","parameter3":"198.575000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:00:00","parameter2":"281","parameter3":"208.000000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:01:00","parameter2":"283","parameter3":"232.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:02:00","parameter2":"305","parameter3":"232.516667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:03:00","parameter2":"294","parameter3":"227.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:04:00","parameter2":"281","parameter3":"219.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:05:00","parameter2":"311","parameter3":"233.533333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:06:00","parameter2":"280","parameter3":"222.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:07:00","parameter2":"294","parameter3":"216.216667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:08:00","parameter2":"258","parameter3":"208.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:09:00","parameter2":"269","parameter3":"214.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:10:00","parameter2":"259","parameter3":"208.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:11:00","parameter2":"272","parameter3":"219.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:12:00","parameter2":"284","parameter3":"222.850000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:13:00","parameter2":"276","parameter3":"221.133333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:14:00","parameter2":"274","parameter3":"228.066667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:15:00","parameter2":"299","parameter3":"231.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:16:00","parameter2":"279","parameter3":"216.250000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:17:00","parameter2":"283","parameter3":"215.966667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:18:00","parameter2":"291","parameter3":"227.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:19:00","parameter2":"288","parameter3":"231.916667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:20:00","parameter2":"285","parameter3":"226.650000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:21:00","parameter2":"281","parameter3":"218.733333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:22:00","parameter2":"325","parameter3":"218.566667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:23:00","parameter2":"343","parameter3":"234.700000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:24:00","parameter2":"373","parameter3":"246.416667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:25:00","parameter2":"332","parameter3":"224.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:26:00","parameter2":"328","parameter3":"237.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:27:00","parameter2":"305","parameter3":"228.616667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:28:00","parameter2":"308","parameter3":"222.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:29:00","parameter2":"274","parameter3":"216.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:30:00","parameter2":"268","parameter3":"218.866667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:31:00","parameter2":"283","parameter3":"224.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:32:00","parameter2":"346","parameter3":"244.800000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:33:00","parameter2":"294","parameter3":"233.683333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:34:00","parameter2":"308","parameter3":"238.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:35:00","parameter2":"289","parameter3":"210.150000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:36:00","parameter2":"288","parameter3":"229.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:37:00","parameter2":"308","parameter3":"235.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:38:00","parameter2":"304","parameter3":"243.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:39:00","parameter2":"320","parameter3":"241.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:40:00","parameter2":"282","parameter3":"224.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:41:00","parameter2":"290","parameter3":"225.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:42:00","parameter2":"337","parameter3":"251.183333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:43:00","parameter2":"294","parameter3":"233.266667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:44:00","parameter2":"303","parameter3":"230.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:45:00","parameter2":"317","parameter3":"233.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:46:00","parameter2":"298","parameter3":"227.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:47:00","parameter2":"298","parameter3":"225.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:48:00","parameter2":"259","parameter3":"214.233333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:49:00","parameter2":"323","parameter3":"227.883333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:50:00","parameter2":"284","parameter3":"236.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:51:00","parameter2":"306","parameter3":"240.933333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:52:00","parameter2":"301","parameter3":"233.750000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:53:00","parameter2":"324","parameter3":"244.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:54:00","parameter2":"293","parameter3":"250.433333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:55:00","parameter2":"301","parameter3":"247.016667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:56:00","parameter2":"293","parameter3":"221.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:57:00","parameter2":"308","parameter3":"239.300000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:58:00","parameter2":"266","parameter3":"222.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:59:00","parameter2":"260","parameter3":"199.400000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 07:59:00","parameter2":"250","parameter3":"198.575000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:00:00","parameter2":"281","parameter3":"208.000000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:01:00","parameter2":"283","parameter3":"232.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:02:00","parameter2":"305","parameter3":"232.516667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:03:00","parameter2":"294","parameter3":"227.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:04:00","parameter2":"281","parameter3":"219.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:05:00","parameter2":"311","parameter3":"233.533333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:06:00","parameter2":"280","parameter3":"222.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:07:00","parameter2":"294","parameter3":"216.216667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:08:00","parameter2":"258","parameter3":"208.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:09:00","parameter2":"269","parameter3":"214.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:10:00","parameter2":"259","parameter3":"208.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:11:00","parameter2":"272","parameter3":"219.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:12:00","parameter2":"284","parameter3":"222.850000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:13:00","parameter2":"276","parameter3":"221.133333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:14:00","parameter2":"274","parameter3":"228.066667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:15:00","parameter2":"299","parameter3":"231.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:16:00","parameter2":"279","parameter3":"216.250000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:17:00","parameter2":"283","parameter3":"215.966667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:18:00","parameter2":"291","parameter3":"227.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:19:00","parameter2":"288","parameter3":"231.916667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:20:00","parameter2":"285","parameter3":"226.650000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:21:00","parameter2":"281","parameter3":"218.733333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:22:00","parameter2":"325","parameter3":"218.566667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:23:00","parameter2":"343","parameter3":"234.700000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:24:00","parameter2":"373","parameter3":"246.416667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:25:00","parameter2":"332","parameter3":"224.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:26:00","parameter2":"328","parameter3":"237.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:27:00","parameter2":"305","parameter3":"228.616667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:28:00","parameter2":"308","parameter3":"222.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:29:00","parameter2":"274","parameter3":"216.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:30:00","parameter2":"268","parameter3":"218.866667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:31:00","parameter2":"283","parameter3":"224.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:32:00","parameter2":"346","parameter3":"244.800000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:33:00","parameter2":"294","parameter3":"233.683333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:34:00","parameter2":"308","parameter3":"238.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:35:00","parameter2":"289","parameter3":"210.150000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:36:00","parameter2":"288","parameter3":"229.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:37:00","parameter2":"308","parameter3":"235.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:38:00","parameter2":"304","parameter3":"243.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:39:00","parameter2":"320","parameter3":"241.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:40:00","parameter2":"282","parameter3":"224.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:41:00","parameter2":"290","parameter3":"225.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:42:00","parameter2":"337","parameter3":"251.183333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:43:00","parameter2":"294","parameter3":"233.266667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:44:00","parameter2":"303","parameter3":"230.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:45:00","parameter2":"317","parameter3":"233.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:46:00","parameter2":"298","parameter3":"227.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:47:00","parameter2":"298","parameter3":"225.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:48:00","parameter2":"259","parameter3":"214.233333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:49:00","parameter2":"323","parameter3":"227.883333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:50:00","parameter2":"284","parameter3":"236.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:51:00","parameter2":"306","parameter3":"240.933333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:52:00","parameter2":"301","parameter3":"233.750000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:53:00","parameter2":"324","parameter3":"244.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:54:00","parameter2":"293","parameter3":"250.433333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:55:00","parameter2":"301","parameter3":"247.016667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:56:00","parameter2":"293","parameter3":"221.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:57:00","parameter2":"308","parameter3":"239.300000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:58:00","parameter2":"266","parameter3":"222.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:59:00","parameter2":"260","parameter3":"199.400000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 07:59:00","parameter2":"250","parameter3":"198.575000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:00:00","parameter2":"281","parameter3":"208.000000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:01:00","parameter2":"283","parameter3":"232.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:02:00","parameter2":"305","parameter3":"232.516667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:03:00","parameter2":"294","parameter3":"227.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:04:00","parameter2":"281","parameter3":"219.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:05:00","parameter2":"311","parameter3":"233.533333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:06:00","parameter2":"280","parameter3":"222.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:07:00","parameter2":"294","parameter3":"216.216667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:08:00","parameter2":"258","parameter3":"208.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:09:00","parameter2":"269","parameter3":"214.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:10:00","parameter2":"259","parameter3":"208.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:11:00","parameter2":"272","parameter3":"219.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:12:00","parameter2":"284","parameter3":"222.850000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:13:00","parameter2":"276","parameter3":"221.133333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:14:00","parameter2":"274","parameter3":"228.066667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:15:00","parameter2":"299","parameter3":"231.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:16:00","parameter2":"279","parameter3":"216.250000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:17:00","parameter2":"283","parameter3":"215.966667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:18:00","parameter2":"291","parameter3":"227.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:19:00","parameter2":"288","parameter3":"231.916667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:20:00","parameter2":"285","parameter3":"226.650000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:21:00","parameter2":"281","parameter3":"218.733333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:22:00","parameter2":"325","parameter3":"218.566667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:23:00","parameter2":"343","parameter3":"234.700000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:24:00","parameter2":"373","parameter3":"246.416667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:25:00","parameter2":"332","parameter3":"224.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:26:00","parameter2":"328","parameter3":"237.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:27:00","parameter2":"305","parameter3":"228.616667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:28:00","parameter2":"308","parameter3":"222.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:29:00","parameter2":"274","parameter3":"216.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:30:00","parameter2":"268","parameter3":"218.866667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:31:00","parameter2":"283","parameter3":"224.033333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:32:00","parameter2":"346","parameter3":"244.800000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:33:00","parameter2":"294","parameter3":"233.683333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:34:00","parameter2":"308","parameter3":"238.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:35:00","parameter2":"289","parameter3":"210.150000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:36:00","parameter2":"288","parameter3":"229.583333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:37:00","parameter2":"308","parameter3":"235.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:38:00","parameter2":"304","parameter3":"243.483333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:39:00","parameter2":"320","parameter3":"241.950000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:40:00","parameter2":"282","parameter3":"224.116667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:41:00","parameter2":"290","parameter3":"225.466667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:42:00","parameter2":"337","parameter3":"251.183333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:43:00","parameter2":"294","parameter3":"233.266667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:44:00","parameter2":"303","parameter3":"230.350000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:45:00","parameter2":"317","parameter3":"233.550000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:46:00","parameter2":"298","parameter3":"227.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:47:00","parameter2":"298","parameter3":"225.816667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:48:00","parameter2":"259","parameter3":"214.233333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:49:00","parameter2":"323","parameter3":"227.883333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:50:00","parameter2":"284","parameter3":"236.366667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:51:00","parameter2":"306","parameter3":"240.933333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:52:00","parameter2":"301","parameter3":"233.750000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:53:00","parameter2":"324","parameter3":"244.383333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:54:00","parameter2":"293","parameter3":"250.433333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:55:00","parameter2":"301","parameter3":"247.016667","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:56:00","parameter2":"293","parameter3":"221.983333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:57:00","parameter2":"308","parameter3":"239.300000","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:58:00","parameter2":"266","parameter3":"222.833333","parameter4":null,"checklists":null},{"id":0,"parameter1":"2017-04-14 08:59:00","parameter2":"260","parameter3":"199.400000","parameter4":null,"checklists":null}],"countOfParams":3}]][0];

var data = new google.visualization.DataTable();
data.addColumn('datetime',json[0].splunkConfig.parameter1);
data.addColumn('number', json[0].splunkConfig.parameter2);
data.addColumn('number', json[0].splunkConfig.parameter3);

$.each(json[0].splunkConfigs, function(i, splunkConfigs) {
var result = [];
data.addRow([
new Date(splunkConfigs.parameter1),
Number(splunkConfigs.parameter2),
Number(splunkConfigs.parameter3)
]);
});

// sort data before drawing
data.sort([{column: 0}]);

var options = {
hAxis : {
title : 'Time',
textStyle : {
color : '#01579b',
fontSize : 20,
fontName : 'Arial',
bold : true,
italic : true
},
titleTextStyle : {
color : '#01579b',
fontSize : 16,
fontName : 'Arial',
bold : false,
italic : true
}
},
vAxis : {
title : 'Count',
textStyle : {
color : '#1a237e',
fontSize : 24,
bold : true
},
titleTextStyle : {
color : '#1a237e',
fontSize : 24,
bold : true
}
},
colors : [ '#a52714', '#097138' ],
title : 'Sample json line chart'
};

// ...etc. Rest of your code comes here, or is called from here.
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.LineChart(document
.getElementById('chart_div'));

chart.draw(data, {
width : 1400,
height : 650
});
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div id="chart_div"></div>

关于javascript - 谷歌折线图上的额外直线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43407764/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com