我正在尝试使用Google Chart API创建烛台图表。但是,无论我如何调整选项,图表看起来都很难看。我错过了吗?
if (data != null){
var d = new google.visualization.DataTable();
d.addColumn("date", "day");
d.addColumn("number", "low");
d.addColumn("number", "open");
d.addColumn("number", "close");
d.addColumn("number", "high");
for(i=data.Time.length-100; i < data.Time.length; i++){
var date = new Date(data.Time[i].Year, data.Time[i].Month, data.Time[i].Day);
d.addRow([date, data.Low[i], data.Open[i], data.Close[i], data.High[i]]);
}
var options = {
legend: 'none',
width: 1200,
height: 600,
bar: {groupWidth: '100%'},
candlestick: {
hollowIsRising: true,
}
};
var chart = new google.visualization.CandlestickChart(document.getElementById('divCharts'));
chart.draw(d, options);
}
然而,如果我只是使用谷歌提供的示例并使用相同的选项,那么图表看起来就像预期的那样:
d = google.visualization.arrayToDataTable([
['Mon', 20, 28, 38, 45],
['Tue', 31, 38, 55, 66],
['Wed', 50, 55, 77, 80],
['Thu', 50, 77, 66, 77],
['Fri', 15, 66, 22, 68]], true); // Treat first row as data as well.