Chart.js: 1.0.2 - devicePixelRatio causes `responsive:true` to result in the wrong size (growing chart)

When the browser has a devicePixelRatio, a CSS height and width are defined on the canvas. The physical height of the element (clientHeight) is determined by this height. When the resize method runs, it updates the canvas.height property to resize the element. If the device’s devicePixelRatio is greater than 1, what that means is that the height is set to a value greater than it should be set.

The net result is that resizing the element causes it to grow on each resize event.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I experience this issue in version 2.5.0

still exists in 2.7.3

For me wrapping with a div classed “relative” helped.