我试图在Dygraph中绘制一些来自OpenTSDB的数据。我有查询工作,我可以绘制数据。但是,当我尝试设置x滚动条属性(如下所示)时,我得到:
Uncaught TypeError: undefined is not a function dygraph-combined.js:2
Dygraph.numberValueFormatter dygraph-combined.js:2
Dygraph.numberAxisLabelFormatter dygraph-combined.js:2
Dygraph.getDateAxis dygraph-combined.js:2
Dygraph.dateTicker dygraph-combined.js:2
Dygraph.addXTicks_ dygraph-combined.js:2
Dygraph.drawGraph_ dygraph-combined.js:2
Dygraph.predraw_ dygraph-combined.js:2
Dygraph.start_ dygraph-combined.js:2
Dygraph.__init__ dygraph-combined.js:2
Dygraph dygraph-combined.js:2
我使用的代码是:
new Dygraph(document.getElementById("graphdiv2"), obj[0].dps, {
labels: [ "Date", "Fuel Level" ],
ylabel: 'Fuel Level',
xlabel: 'Date',
axes: {
x: {
valueFormatter: Dygraph.dateString_,
ticker: Dygraph.dateTicker }
},
xValueParser: function(x) { return parseInt(x); }
});
如果我取出ticker: Dygraph.dateTicker
选项,那么图表就会完美地绘制,当我将鼠标悬停在图表上时显示的值是正确的日期和时间,但是刻度值是unix时间戳。这是什么问题?