在c3堆积条形图中,某些条形图的渲染宽度与其他条形图不同

时间:2018-03-01 15:35:17

标签: javascript d3.js c3.js

我有一个使用C3图表创建的堆积条形图。

var chart = c3.generate({
            bindto: '#chart',
            data: {
                json: d,
                keys: {
                    x: 'Date',
                    value: ['Other', 'P2', 'P1']
                },
                type: 'bar',
                groups: [
                    ['P1', 'P2', 'Other']
                ],
                order: false,
                names: {
                    P1: 'P1',
                    P2: 'P2',
                    Other: 'Other'
                }
            },
            bar: {
                width: {
                    ratio: 1 / (((d.length - 3) / 3 * 2) + 0.6)
                }
            },
            axis: {
                x: {
                    type: 'timeseries',
                    tick: {
                        format: '%b-%d',
                        //count: 7,
                        culling: {
                            max:3
                        }
                    }
                },
                y: {
                    min: 0,
                    padding: {
                        bottom: 0
                    }
                }
            },
            grid: {
                y: {
                    lines: [{ value: 0 }]
                }
            }
        });

Please check it here.

但有时候酒吧的宽度不同。我正在做的事情有什么不妥。

我在某些屏幕上看到的内容如下图所示。

enter image description here

宽度计算中是否有任何问题。请纠正我。

提前致谢。

0 个答案:

没有答案
相关问题