Throw error for incorrect types passed into configuration object
See original GitHub issueExpected 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* 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)
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
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
These days I think this is looking a lot better. We now ship Typescript types in the npm distribution as of v3.0.0-beta.1 and so editors/linters will catch this. Not sure if it’s enough to close this issue, but it’s an improvement
Closing since we won’t move forward with this and TS is our solution