尽管我找到了正确的数据,但我发现图表上存在两个数据记录,其日期标记为“ Nov 4th”。 See Screenshot
这是我写的代码:
new Keen.Dataviz()
.el('#actionChart')
.title(' ')
.chartOptions({
axis: {
y: {
label: {
text: 'Count',
position: 'outer-middle'
},
min: 0,
padding: { bottom: 0 }
},
}
})
.height(300)
.colorMapping({
Presented: ANALYTICS_COLORS[1],
Facebook: ANALYTICS_COLORS[3],
SMS: ANALYTICS_COLORS[2]
})
.type('line')
.stacked(false)
.prepare();
});
以及我得到的数据:
{"result": [{"value": [{"action": "presented", "result": 1661}, {"action": "selected_facebook", "result": 21}], "timeframe": {"start": "2018-11-01T07:00:00.000Z", "end": "2018-11-02T07:00:00.000Z"}}, {"value": [{"action": "presented", "result": 1398}, {"action": "selected_facebook", "result": 9}], "timeframe": {"start": "2018-11-02T07:00:00.000Z", "end": "2018-11-03T07:00:00.000Z"}}, {"value": [{"action": "presented", "result": 1718}, {"action": "selected_facebook", "result": 17}], "timeframe": {"start": "2018-11-03T07:00:00.000Z", "end": "2018-11-04T07:00:00.000Z"}}, {"value": [{"action": "presented", "result": 1498}, {"action": "selected_facebook", "result": 16}], "timeframe": {"start": "2018-11-04T07:00:00.000Z", "end": "2018-11-05T07:00:00.000Z"}}, {"value": [{"action": "presented", "result": 1330}, {"action": "selected_facebook", "result": 10}], "timeframe": {"start": "2018-11-05T07:00:00.000Z", "end": "2018-11-06T07:00:00.000Z"}}, {"value": [{"action": "presented", "result": 1351}, {"action": "selected_facebook", "result": 20}], "timeframe": {"start": "2018-11-06T07:00:00.000Z", "end": "2018-11-07T07:00:00.000Z"}}, {"value": [{"action": "presented", "result": 1819}, {"action": "selected_facebook", "result": 12}], "timeframe": {"start": "2018-11-07T07:00:00.000Z", "end": "2018-11-08T07:00:00.000Z"}}]}
我尝试了the latest .js file,并且发生了同样的问题
还要添加
axis: {
x: {
localtime: false
}
},
不起作用,请参见here
答案 0 :(得分:0)
从.call(function(){console.log(this.dataset);})
中查找原因:
时区不同。在GMT-7之前,最后三个
答案 1 :(得分:0)
这可能与c3本地时区转换有关。 https://github.com/keen/keen-dataviz.js#date-format 要关闭转换,请使用以下代码:
const chart = new KeenDataviz({
container: '#some_container', // required
axis: {
x: {
localtime: false
}
}
});