• I have a map created in Amcharts4 that I want to put into a WordPress page using the Amcharts WordPress adapter. I am using dynamic data from a php page to fill the data for polygon series.

    worldSeries.datasource.url = “/data_adapters/JMA_data.php?O=CMI”;
    worldSeries.dataSource.parser = new am4core.JSONParser();
    worldSeries.dataSource.Load();

    /data_adapters/JMA_data.php does a database query and echos a json string.

    I can call it from the server using the url: https://yorkriteconference.org/amcharts_4d/index_T2_dev.html and it works fine.

    When I put the javascript into the adapter, the data cannot load.

    Any help would be greatly appreciated!

    Rod Wagoner
    Tucson, AZ

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Rod

    The amcharts “adapter” really doesn’t do anything unique, except to handle the amcharts js scripts and making sure there is a known div to place the output. Other than that, the amchart js code should run fine. I develop all my charts in IntelliJ and I only need to change the reference to the data source (from a local dir to a server dir).

    Can you look at the console tab in your browser inspector to see what the error is – 404, cross-origin, etc.?

    Another possibility – have you changed the div reference in your code? The HTML section of the plugin requires the following:
    <div id=”$CHART$” style=”width: 100%; height: 500px;”></div>

    So your code needs to reference $CHART$ instead of the hardcoded div name in your code. Sounds basic, but this is often the problem when I migrate to the plugin.

    In your JS code, change:
    root = am5.Root.new ( “chartDiv” );
    to:
    root = am5.Root.new ( $CHART$ );

Viewing 1 replies (of 1 total)
  • The topic ‘Amcharts 4 datasource.url’ is closed to new replies.