jquery - Hide/Show and Resize Issue with Am Charts -
jquery - Hide/Show and Resize Issue with Am Charts -
i'm having problem jquery plugin called amcharts. issue i'm having want hidden when site loads, when button clicked should shown. jquery set properly, when button clicked chart not appear. @ first. click button , resize window, chart magically appears , stays. seems bug of kind, i'm not proficient plenty jquery yet certain. here's jquery code:
$("#button").show(); $("#chartdiv").hide(); $("#button").click(function(){ $("#chartdiv").toggle(); }); var chart = amcharts.makechart("chartdiv", { "type": "pie", "theme": "none", "starteffect": "easeoutsine", "legend": { "markertype": "circle", "position": "bottom", "marginright": 0, "automargins": false }, labelsenabled: false, "dataprovider": [{ "pictures": "stock", "total": 256.9 }, { "pictures": "3rd party", "total": 131.1 }, { "pictures": "360 spin", "total": 115.8 }, { "pictures": "360 detail", "total": 109.9 }, { "pictures": "no content", "total": 132 }], "valuefield": "total", "titlefield": "pictures", "balloontext": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]%)</span>", "exportconfig": { "menutop": "0px", "menuitems": [{ "icon": '/lib/3/images/export.png', "format": 'png' }] } }); here's working fiddle see i'm talking about. help appreciated!
amcharts doesn't know how measure size if it's hidden.
you have tell update size explicitly using:
chart.handleresize(); the reply taken here: http://stackoverflow.com/a/22070739/478440
and here updated , working fiddle: http://jsfiddle.net/n3fpz/1/
nonetheless take account, 1 of other responses says, it's not finish solution, , can give problems other things such margins or axis.
jquery hide show show-hide window-resize
Comments
Post a Comment