Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amcharts shows data only on resize event

I am having a really strange error while using AmCharts preview in twitter bootstrap modal.
Actually its a modal that is used to preview some graph data but it does not actually shows graphs sometimes until:

-I open inspect element dialog.(means window resize event)
-Or by re sizing the inspect element dialog if its already open.(again means window resize event)
-I manually resize browser window

From perspective of my backend there is no problem sending data it always send same data.

I know my problem is really silly but i think may be someone might occurred with this one.
Thanks in advance

like image 514
Sachin Verma Avatar asked Oct 02 '22 02:10

Sachin Verma


1 Answers

had the same problem, fixed by resizing after modal is shown

$('#myModal').on('shown.bs.modal', function (e) {
chart.invalidateNow();
chart.validateSize();
}
like image 81
bigswoll Avatar answered Oct 09 '22 12:10

bigswoll