Make Amcharts work in WordPress tabs
-
Hi,
I′d like to use Amcharts shortcodes to display some charts in multiple tabs on a single page.The first chart [amcharts id=”chart-1″] displays in the first div as expected.
However, clicking on subsequent tabs reveals blank divs. The charts won′t display.
***
The documentation provides an explanation here:
https://www.amcharts.com/docs/v3/tutorials/displaying-charts-in-tabs-or-other-dynamic-page-elements/
and a fiddle: https://jsfiddle.net/amcharts/mZ2Gq/So guessing that this chart.invalidateSize code should go in the javascript input field for the Amcharts wordpress plugin. Something like this perhaps?
$(function() { $( "#tab" ).tabs({ select: function(event, ui) { console.log('Calling chart.invalidateSize()'); chart.invalidateSize(); } }); });
Using that code example creates an a TypeError in the javascript console.
What code is needed to make it run correctly in WordPress?
- The topic ‘Make Amcharts work in WordPress tabs’ is closed to new replies.