c3js / c3

:bar_chart: A D3-based reusable chart library
http://c3js.org
MIT License
9.33k stars 1.39k forks source link

Legend step is not working when change legend text font-size #2840

Open ektadesai22 opened 3 years ago

ektadesai22 commented 3 years ago

There is dependency of font-size to calculate step in updateValues(). It should not be depend on font-size of legend text. Default is 12px and when I changed it to 10px, steps did not work as expected.

image

var chart = c3.generate({
    data: {
        columns: [
            ['data1', 30, 200, 100, 400, 150, 250],
            ['data2', 50, 20, 10, 40, 15, 25],
            ['data3', 30, 34, 100, 440, 100, 220],
            ['data4', 50, 20, 9, 40, 75, 30],
            ['data5', 150, 18, 9, 40, 75, 30],
        ]
    },
    legend: {
        position: 'inset',
        inset: {
            step: 3
        }
    }
});

To fix this I have made below changes to work step as expected. image image