You must be logged in to post your query.
Home › Forums › Chart Support › style.height and style.width not preserved
Tagged: div js chart
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>
<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 picture in expected size is shown if inspect element is selected :
Please suggest how to make the chart to show in actual size after OnClick ?
@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
You must be logged in to reply to this topic. Login/Register