C3 graph overlapping x-axis label
Asked Answered
G

1

7

C3 graph overlap x-axis labels which is in date time format. I have googled this query but didn't get any solution for it.Is it possible that c3 only shows couple of date time rather then showing altogether which result in overlap x-axis labels enter image description here

var data = {
    x: 'x',
    xFormat:'%Y-%m-%d/%H:%M',
    empty: {
        label: {
          text: "No Data"
        }
    },
    columns: [
        ['x', '{$dateArray}'],
        ['Attack', {$data}],
    ],colors: {
        Attack: '#67b7dc',
    },
    types: {
        Attack: 'area'
    }};
var chart = c3.generate({bindto: '#chart1',
size: {
    height: 630,
},
data: data,
grid: {
    x: {
        show: true
    },
    y: {
        show: true
    }
},
tooltip: {
    format: {
        value: function (value, ratio, id) {
            var format = value+' Gbps  [ IP: '+destIp[value]+' ]';
            return format;            
        }
    }
},
zoom: {
    enabled: true
},
subchart: {
    show: true
},axis: {
    x: {
        type: 'timeseries',
        tick: {
            format: '%b %d, %H:%M',
            rotate: 90,
            multiline: false
        }
    },
    y: {
        tick: {
            format: function (d) {
                return d.toFixed(3);
            }
        },
        label: {
            text: 'Attack Size ( Gbps )',
            position: 'outer-middle'
        }
    }
}
});
Gladi answered 1/8, 2016 at 11:29 Comment(0)
F
5

Use c3.js chart config tick.count, set it to desired integer value like 2,3 or 4.

Use c3.js Timeseries Chart exmaple to play with this config.

Problem without tick.count:- enter image description here

Problem solved with tick.count config:- enter image description here

Fivestar answered 2/8, 2016 at 9:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.