c3 icon indicating copy to clipboard operation
c3 copied to clipboard

setting padding.top causes miscalculated graph height

Open annayo opened this issue 12 years ago • 2 comments

Graph height is miscalculated if padding.top is set:


c3.generate({
            padding: {
                top: 100,
                right: 0,
                bottom: 100,
                left: 40
            },
            size: {
                height: 400
            },
            data: {...}
})

With padding.top defined (renders container at correct height but graph is squashed): screen shot 2014-06-04 at 8 42 10 pm

Without padding.top: screen shot 2014-06-04 at 8 43 59 pm

annayo avatar Jun 05 '14 03:06 annayo

Hi, Thank you for opening this issue. This is a little confusing, but it's not a bug. I mean the height is the height of the svg, not of the chart area on it. And padding is the padding for svg, so this seems working as I intends. e.g. If height is 400 and padding.top and padding.bottom are 100, then the height of the chart area will be 200 (= 400 - 100 - 100).

If yo want to leave a space on top/bottom, it would be better to set as style on the div where the chart inserted. (or add the sum of padding.top/bottom to the height. In this case, if height = 600, padding.top/bottom = 100, then height = 400)

masayuki0812 avatar Jun 06 '14 00:06 masayuki0812

I'll close this issue. Please open a new topic in google group if needed. https://groups.google.com/forum/#!forum/c3js

masayuki0812 avatar Jun 21 '14 06:06 masayuki0812