这是我的 json 数据的输出。
[["Period","SOC","Control Signal","Charge/discharge"],
["00:00:00",60,0.01,0.01],
["00:01:00",58,0.01,0.01],
["00:02:00",56,0.01,0.01],
["00:03:00",55,0,0],
["00:04:00",54,0,0],
["00:05:00",53,-0.01,-0.01],
["00:30:00",53,-0.01,-0.01]]
我正在传递这些数据...
var table="holds my json data";
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var obj = jQuery.parseJSON(table);
var data = google.visualization.arrayToDataTable(obj)
var options = {
title: 'Charge Discharge Management',
curveType: 'function',
series: {0: {targetAxisIndex:0},
1:{targetAxisIndex:1},
},
'hAxis':{textPosition: 'none'}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
正如我们在图像中看到的,h 轴上每个时间之间的时间差是“1 分钟”,但最后是“5”-“30”......如何使其成为线性?