Skip to content

[BUG] Display none with maintainAspectRatio: false causes squished chart #4659

Description

@nelsyeung

Expected Behavior

When the canvas container has style="display: none;" then later on set to block using JS, used with the chart option maintainAspectRatio: false, the chart should be the same size as without the complications with display: none.

Current Behavior

When the canvas container has style="display: none;" then later on set to block using JS, used with the chart option maintainAspectRatio: false, the height of the chart is squished to around 20px or in some cases 0px.

Steps to Reproduce (for bugs)

fiddle

  1. Press "Toggle Display"
  2. You should see that the chart is squished (very low height).
  3. Remove the style="display: none; and re-run the fiddle.
  4. You should see that the chart is the correct size.

I expect both to have the same size.

Environment

  • Chart.js version: 2.6.0
  • Browser name and version: Firefox 54.0.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions