我正在尝试从Stephen A. Thomas的Data Visualization with JavaScript一书中复制一个介绍性示例(No Starch Press,2015)
这是代码:
HTML
<div id="chart" style="width:600px;height:300px;"></div>
JS
var wins = [[
[2006, 13],
[2007, 11],
[2008, 15],
[2009, 15],
[2010, 18],
[2011, 21],
[2012, 28]
]];
var years = [
[0, "2006"],
[1, "2007"],
[2, "2008"],
[3, "2009"],
[4, "2010"],
[5, "2011"],
[6, "2012"]
]
Flotr.draw(document.getElementById("chart"), wins, {
bars: {
show: true,
barWidth: 0.5
},
yaxis: {
min: 0,
tickDecimals: 0
},
xaxis: {
ticks: years
}
});
我面临的问题是标签(years
)没有显示为xaxis
.
是什么导致years
数据不填充?
编辑: Firefox 中没有显示年份,Chrome 中的屏幕完全空白。