Home › forums › Using CanvasJS › Styling Being Ignored? Chart too big for page.
This topic contains 2 replies, has 2 voices, and was last updated by Anjali 5 years ago.
I’m experimenting with this as a charting solution, however I’ve run into an issue and I’m not sure if it is me or a bug of some sort.
If I call chart.render() from inside a document.ready function the chart renders nicely and within its set styling, eg height: 300px; width: 95%;
However if I query a local WebSQL database and call chart.render() from inside that function, the chart ignores all styling, whether inline or in css and is too big for the page.
Where am I going wrong here?
here’s a fiddle that highlights the problem… http://jsfiddle.net/NtnSe/5/
When the container is hidden it will take the height and width 0 so that canvas is using it’s default width and height (500 * 400). So You just need to call chart.render() after you are going to show the div in which you are plotting the chart so that chart will use the width and height of container. Here is an example.
You must be logged in to reply to this topic.