-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
Milestone
Description
Look at this little fiddle:
https://jsfiddle.net/ycdbv5sq/
Resize the chart by increasing its width. The bottom of the chart will be clipped.
This is because maintainAspectRatio always takes the width as base and calculates (and sets) the heigth from it (never does it from opposite approach), as I see in getMaximumSize:.
width = Math.max(0, width - margins.width);
height = Math.max(0, aspectRatio ? Math.floor(width / aspectRatio) : height - margins.height);
maintainAspectRatio should do the following, IMHO:
- calculate chart height based on width (and ratio)
- if this height is smaller or equal to the current height of the container, render the chart with this size
- if the height calculated above is greater than the current height of the container, calculate the width of the chart based on the height and the ratio (and use this width for rendering)
This could ensure that the entire chart is visible.