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 2 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7039

    warria98
    Participant

    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?

    #7041

    warria98
    Participant

    here’s a fiddle that highlights the problem… http://jsfiddle.net/NtnSe/5/

    #7069

    Anjali
    Participant

    Hi,

    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.

    __
    Anjali

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.