c3 step chart align on event

2019-08-21 02:54发布

问题:

I have a c3/d3 step chart with some boolean values. Now I need to align the step change on the actual event timestamp and not in the middle of that event.

Is there any config option so c3 step chart changes the line from 0 to 1 exactly when the event occurs?

回答1:

It seems that you're talking about line.step.type option:

var chart = c3.generate({
    data: {
        columns: [
            ['data1', 300, 350, 300, 0, 0, 100]
        ],
        types: {
            data1: 'step'
        }
    },

    // that's it:
    line: {
      step: {
        type: 'step-after'
      }
    }
});


标签: charts c3.js