c3 icon indicating copy to clipboard operation
c3 copied to clipboard

resize() only accepts pixels

Open nalnaji opened this issue 11 years ago • 1 comments

Is it possible for the chart's height and width to be set based on percentage? Example:

chart.resize({height: 100%, width: 100%});

nalnaji avatar Aug 05 '15 00:08 nalnaji

This is quite normal behaviour - as you are already using JS, simply use either d3, jQuery or the DOM API to get the height of the element you are targeting:

$('#graphContainerId').width()

I think it's reasonable that you would be expected to handle the sizing, C3 can easily get it wrong, due to the number of different requirements users have - so I'd suggest you handle the initial sizing, and resizing logic yourself.

Also, percentage height only exists in HTML when you have a fixed height element (or element that is an exact percentage of a fixed element), so the short answer is that there is no reliable percentage height. Given that it is so easy for you to get the size of the containing element, why not simply handle this in your code?

SamMorrowDrums avatar Aug 26 '15 09:08 SamMorrowDrums