Skip to content

Throw error for incorrect types passed into configuration object #4089

@lfox91

Description

@lfox91

Expected Behavior

When setting options tooptions={ responsive: true, maintainAspectRatio: false, } and placing the canvas inside of a dedicated container with relative positioning width: 100vw; height: 50vh I expect the chart to be as wide as the screen and half the height of the window, even after a resize. I also expect that when I destroy and place a new chart on the same canvas that the new chart will also have the same dimensions and respond correctly to a resize

Current Behavior

The chart disappears. There is a tiny dot in the top left corner. I'm guessing this is my squished chart(?) The graph container has the correct dimensions, the iframe has the correct dimensions, as does the canvas. Which leads me to believe it is happening in the draw function. I'm not entirely sure when the chart is drawn. Maybe the draw happens before the iframe is ready?
Edit*
screen shot 2017-03-29 at 2 25 58 pm
Ah! I found this. Where would it be getting those numbers? It would be nice to see an error for NaN inputs.
Final Edit*
I had set borderWidth to "5px" and everything exploded silently.

Steps to Reproduce (for bugs)

My JSBIN

Context

This is an internal app for our business division. I expect this will be viewed on many different devices. I have found dimensions that I like for just about all screens - except maybe a wearable - I'd love to have the ability to control the height and width of the graph when the container is resized.

Environment

  • Chart.js version: 2.5.0 - same error with 2.2
  • Browser name and version: 57.0.2987.98 (Official Build) (64-bit)
  • Link to your project: github.com/lfox91/ytanalytics

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions