我不断收到以下错误:devtool控制台中出现“Uncaught Requested parser” 并且我的仪表板上没有显示图表。
JS代码:
var chart = new Keen.Dataviz()
.el('#chart-01')
.height(280)
.title('Registered CSRs')
.type('bar')
.prepare();
// Fetch data from my server's API
var json = $.ajax({
url: "/api/v1.0/registered_csrs/nwg",
dataType: "json",
success: function (jsonData) {
chart
.data(jsonData)
.render();
}
});
这是jsonData
的格式$ curl -GET http://localhost:4000/api/v1.0/registered_csrs/nwg
[["Date", "Total", "Emergency", "High", "Medium", "Low"],
["2016-02-01", 1, 0, 0, 1, 0],
["2016-03-01", 6, 0, 0, 6, 0],
["2016-04-01", 11, 0, 1, 7, 3],
["2016-05-01", 19, 0, 1, 16, 2],
["2016-06-01", 27, 0, 12, 13, 2],
["2016-07-01", 27, 3, 12, 12, 0],
["2016-08-01", 25, 3, 8, 11, 3],
["2016-09-01", 21, 4, 10, 5, 2],
["2016-10-01", 19, 3, 4, 11, 1],
["2016-11-01", 29, 4, 12, 12, 1],
["2016-12-01", 26, 2, 9, 14, 1],
["2017-01-01", 16, 1, 3, 11, 1],
["2017-02-01", 22, 2, 8, 11, 1],
["2017-03-01", 28, 2, 10, 14, 2],
["2017-04-01", 15, 2, 6, 5, 2],
["2017-05-01", 28, 2, 7, 18, 1],
["2017-06-01", 22, 1, 11, 8, 2],
["2017-07-01", 10, 1, 4, 5, 0]]
答案 0 :(得分:0)
看一看 Keen.io Dataviz to draw graph but keep getting error "Uncaught Requested parser does not exist"
https://keen.io/docs/visualize/visualize-your-own-data/
以下代码应该可以在您的应用中正常使用
chart
.data({result: jsonData})
.render();