0

I just find there exist two data records with labeled date "Nov 4th" on the chart though I got the right data. See Screenshot

Here is the code I wrote:

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();

});

and the data I got:

{"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"}}]}

I tried the latest .js file, and same problem happens

also, add

axis: {
    x: {
        localtime: false
    }
},

does not work, see here

Tapir
  • 3
  • 3

2 Answers2

0

Find the reason from .call(function(){console.log(this.dataset);}):

the timezone is different. Before it's GMT-7, the last three

Tapir
  • 3
  • 3
  • but still don't know why it gets the different timezones, in raw data the they are the same – Tapir Nov 08 '18 at 22:55
0

it's probably related to c3 local timezone conversion. https://github.com/keen/keen-dataviz.js#date-format To turn off the conversion use the code below:

const chart = new KeenDataviz({
  container: '#some_container', // required
  axis: {
    x: {
      localtime: false
    }
  }
});
AdamKas
  • 1
  • 4
  • Thank you for the help, but it does not work somehow, I've attached the screenshot in the question – Tapir Nov 14 '18 at 18:13
  • Another problem is every time I call render(data) with the same chart object, the label showed when hover on the graph is duplicated with the latest data – Tapir Nov 14 '18 at 18:55