c3js,X 轴被压碎且格式错误

c3js, X Axis crushed and badly formated

目前我正在玩这个例子: http://c3js.org/samples/axes_x_tick_culling.html

但问题是,当您添加 3-4 倍的数据量时,X 值会被压碎且格式错误。我该如何解决这个问题?

看这里:http://i.imgur.com/F7BWMDk.png

谢谢。

给你, 您需要添加 tick.width 参数。 尚未记录(我们正在处理)

var chart = c3.generate({
    data: {
        columns: [
                        ['sq', 30, 200, 100, 400, 150, 11,11,11,11,111,11,11,11,22,22,22,22,22,223,43,32,14,250, 30,31, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250]]
        
    },
    axis: {
        x: {
            type: 'category',
            tick: {
                culling: true,
                width: 11
            }
        }
    }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
<div id="chart">
</div>

var chart = c3.generate({
data: {
    columns: [
                    ['sq', 30, 200, 100, 400, 150, 11,11,11,11,111,11,11,11,22,22,22,22,22,223,43,32,14,250, 30,31, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250]]

},
axis: {
    x: {
        type: 'category',
        tick: {
            culling: true,
            width: 11
        }
    }
}

});

jsfiddle

宽度对我来说很好,看看X axis with tripple digit numbers

enter link description here

var chart = c3.generate({
data: {
    columns: [
        ['sq', 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250,30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250,30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250,30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250,30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250,30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250,30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250]

]

},
axis: {
    x: {
        type: 'category',
        tick: {
        width: 22,
            culling: {
                max: 7 
            }
        }
    }
}

});