5

The chart is pretty good when it is normal. but i expect it to adjust the bar width upon zoom. The graph without zoom is as below.

enter image description here

when I zoom into the graph, the bars width remains same, very thin!

enter image description here

Is there anyway that they auto adjust? I saw a link where the example adjusts the bar width with the zoom. But I don't see anything missing. Here's the example : http://blog.trifork.com/2014/07/29/creating-charts-with-c3-js/

Here's my charting code. Am I missing some setting?

var chart = c3.generate({
    bindto: '#chart',
    data: {
        xFormat: '%m/%d/%y %I:%M %p',
        json: final_data,
        keys: {
            x: 'date',
            value: values
        },
        type: 'bar',
        groups: val
    },
    bar: {
        width: { ratio: 0.9 }
    },
    axis: {
        x: {
            type: 'timeseries',
            tick: {
                format: '%b %d'
            }
        }
    },
    zoom: {
        enabled: true
    },
    color: {
        pattern: colors
    }
});
4

1 回答 1

0

尝试删除键值对“bar”。如果问题仍然存在,请尝试设置axis.x.tick.fit = false

于 2016-11-15T10:12:26.490 回答