Home forums Using CanvasJS style.height and style.width not preserved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Vishwas R 1 week, 2 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25849

    I have a Canvas JS chart . I have defined onclick event on the bar plots. There are separate charts on the page with display set to none.
    <div id="chartContainer2000" style="height: 370px; width: 100%; display:none"></div>

    The OnClick event sets the style.display to ‘block’. But if I set it to ‘inline’, no chart is displayed. Only if I set it to “block” the chart is displayed but with a smaller size. I want it to be 370pxby1000px. I have tried setting x.style.height=360px in the onclick event but still it does not happen.

    The picture that comes is this after OnClick:
    The actual image

    The picture in expected size is shown if inspect element is selected :
    Expected size comes after clicking inspect element.

    Please suggest how to make the chart to show in actual size after OnClick ?

    #25862

    @sayak-chowdhury,

    Rendering charts (that are hidden initially) after onClick should work fine in this case.

    If you are still facing the issue, kindly create JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code, understand the scenario better and help you out.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.