Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign uphorizontal bar chart increases row height on resize when maintainAspectRatio is set to false #2538
Comments
This comment has been minimized.
This comment has been minimized.
|
Same issue with a line chart I am making :/ |
This comment has been minimized.
This comment has been minimized.
|
@ThaJay if you want a workaround for now, set a max height on the container of the chart which limits how far the chart stretches out in height. To avoid inconsistency I also set a height and max height of the same amount (keeping it constant across all screen heights) |
This comment has been minimized.
This comment has been minimized.
|
The good news is that I now know what causes this. The bad news is that I don't yet know the fully cross-browser way to fix it so I need to do some testing on my end. The gist of it is described in http://stackoverflow.com/questions/8600393/there-is-a-4px-gap-below-canvas-video-audio-elements-in-html5 In the fiddle i added some CSS to make the canvas |
This comment has been minimized.
This comment has been minimized.
|
Ok, the summary of my research is in the table below. 'Yes' indicates that the browser CSS display combination includes an extra 4 px at the bottom.
|
This comment has been minimized.
This comment has been minimized.
|
Fixed in 2.1.6 we default to a block style if one is not set on the canvas. See https://jsfiddle.net/pxzzo24p/1/ |
This comment has been minimized.
This comment has been minimized.
|
I ran into this issue on 2.3.0. It occurred because the container had other items in it besides from the canvas. By putting the canvas inside its own container and setting container position:relative everything works beautifully. Example how to break it: https://jsfiddle.net/pxzzo24p/14/ |
Steps to reproduce:
new Chart(ctx, {type: 'horizontalBar', data})maintainAspectRatio: falsehttps://jsfiddle.net/pzx1LtqL/3/