我有一个包含多个系列的折线图:
速度在-20到130的范围内,而RPM在0到8000的范围内。我希望将这两个系列分别缩放,以便我可以清楚地看到两者的趋势。
我的绘图功能看起来像这样:
var do_chart = function (readings) {
var data = new google.visualization.DataTable();
data.addColumn('datetime', 'Time');
var fields_using = $('#select-y').val();
// fields are selected from a select dropdown
_.forEach(fields_using, function(v) {
data.addColumn('number', v);
});
_.forEach(readings, function (v) {
var row = [new Date(v.timestamp)];
_.forEach(fields_using, function(f) {
row.push(v[f]);
});
data.addRow(row);
});
var options = {
title: 'Speed vs. Time',
curveType: 'function',
animation:{
duration: 100,
startup: true
},
explorer: {
actions: ['dragToZoom', 'rightClickToReset'],
axis: 'horizontal',
keepInBounds: true,
maxZoomIn: 0
},
legend: {position: 'bottom'}
};
var chart = new google.visualization.LineChart(document.getElementById('chart'));
chart.draw(data, options);
}