question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resize chart height on parent div resize

See original GitHub issue

When resizing the div where the chart is created, the chart automatically resizes horizontally, but not vertically because of this line:

Line 880

$$.selectChart.style('max-height', $$.currentHeight + "px");

Please consider changing this in order to support full resize

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:9

github_iconTop GitHub Comments

4reactions
richardoptibriumcommented, Mar 20, 2020

I’m still seeing this problem in 0.7.15

3reactions
pqvstcommented, Nov 12, 2015

Indeed. The chart can shrink, but once it’s shrunk it won’t expand again (because of max-height). http://i.imgur.com/hbvDUkX.gifv

Once the chart has shrunk it doesn’t work to call resize() or flush() either. Workaround:

var el = ...;
var $el = $(el);
c3.generate({
    ...,
    onresize: function () {
        $el.css("max-height", "none");
    }
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Resize a chart on parent div resize - Stack Overflow
1 Answer 1 ... You can set the dimensions of the chart on resize event of window. $(window).resize(function() { resetDimensions(); });.
Read more >
Resize chart according to div height and width - Highcharts
Hi, How to resize the chart to fit into the div height and width. If I reduce the height and width of the...
Read more >
Responsive Charts - Chart.js
Chart.js provides a few options to enable responsiveness and control the resize behavior of charts by detecting when the canvas display size ......
Read more >
D3.js tutorial - Part 9 - Resize chart - Lulu's blog
To adapt our chart to the parent division, we need to know its size. The parent size can be retreived with the style()...
Read more >
Resize Canvas when parent-div got resized | CanvasJS Charts
In the latest version you can just call render method whenever its container's size changes and the chart readjusts its size (only if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found