Support » Plugin: amCharts: Charts and Maps » Charts are not updated

  • Have:
    Local Server Ubuntu 16.04;
    Windows Client with IE11.
    Installed from the site wordpress.org:
    CMS WordPress 4.9.2;
    Plugin amcharts-charts-and-maps.1.1.6;
    Plugin wp-polls.2.73.8.
    and also:
    amCharts examples xy multiaxis and serial2 charts.
    Codes:
    xy multiaxis chart:
    html
    <div id=”$CHART$” style=”width: 100%; height: 500px;”></div>

    <script src=”/resources/dataloader/dataloader.min.js”></script>
    js
    var chart = AmCharts.makeChart(“$CHART$”, {
    “type”: “xy”,
    },

    “dataLoader”: {
    “url”: “data/data1.json”,
    “showErrors”: true,
    “complete”: function ( chart ) {
    console.log( “Loading complete” );
    },
    “load”: function ( options, chart ) {
    console.log( “File loaded: “, options.url );
    },
    “error”: function ( options, chart ) {
    console.log( “Error occured loading file: “, options.url );
    },
    “reload”: 120,
    “async”: true
    },

    });

    function reloadData() {
    chart.dataLoader.loadData();
    chart.validateData();
    }
    serial chart:
    html
    <div id=”chartdiv” style=”width: 100%; height: 500px;”></div>

    <script src=”/resources/dataloader/dataloader.min.js”></script>

    <input type=”button” value=”New Data” onclick=”reloadData();” />
    js
    var chart = AmCharts.makeChart(“chartdiv”, {
    “type”: “serial”,

    “dateFormat”: “DD-MM-YYYY HH:NN”,

    “dataLoader”: {
    “url”: “data/data2.json”,
    “showErrors”: true,
    “complete”: function ( chart ) {
    console.log( “Loading complete” );
    },
    “load”: function ( options, chart ) {
    console.log( “File loaded: “, options.url );
    },
    “error”: function ( options, chart ) {
    console.log( “Error occured loading file: “, options.url );
    },
    “reload”: 60,
    “async”: true
    },

    });

    function reloadData() {
    chart.dataLoader.loadData();
    chart.validateData();
    };

    chart.addListener(“dataUpdated”, zoomChart);
    zoomChart();
    function zoomChart(){
    chart.zoomToIndexes(chart.dataProvider.length – 20, chart.dataProvider.length – 1);
    }
    When opened in WordPress- Chart and Maps – Chart1 or chart2 they are perfectly displayed.
    Also displayed via shortcodes on the pages.
    startDuration and they charts periodically twitch. Also twitching on the button. If you have a large amount of data, you receive a “Loading…” message. But the chart is not updated.
    In debug mode, IE F12 produces an error in the Global code [string: 627, column: 3], post.php :
    <script type=”text/javascript”>
    QTags.addButton(‘ed_wp_polls’, ‘Poll’, function() {
    var poll_id = jQuery.trim(prompt(‘Enter Poll ID’));
    while(isNaN(poll_id)) {
    poll_id = jQuery.trim(prompt(“Error: Poll ID must be numeric\n\nPlease enter Poll ID again”));
    }
    if (poll_id >= -1 && poll_id != null && poll_id != “”) {
    QTags.insertContent(‘[poll id=”‘ + poll_id + ‘”]’);
    }
    });
    “QTags” not defined
    </script>
    Question
    How to make them still and updated. I’ve been suffering for a long time.

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • At this point, using the graphics function
    function reloadData() {
    var NewChartData = [];
    NewChartData = chart.dataLoader.loadData();
    NewChartData.push(JSON.parse());
    chart.dataProvider = NewChartData;
    chart.validateData();
    };
    is also loaded from the. json file and from the. php file, but only once when opened from the WordPress Admin panel.
    Automatically and when you click on the button they still do not update, ie shudder, but do not change. The data differs only by values, even the file size is identical. May be in the plugin the ability to update data is blocked. Sorry, but probably have to give up the plugin Amcharts.
    Good luck friends.

    Plugin Author martynasma

    (@martynasma)

    Hm, I’m terribly sorry, but it seems I have missed your original message.

    If you haven’t gone too far away yet, and would like to take another stab, I’d be willing to help you out.

    Would you be able to provide a link so that I can check what’s going on with your map setup?

    The original link is pointing to a WP website.

    Hello Martynasma.
    Here is what I tried to get to work, but unfortunately did not get the result.
    xy multiaxis chart:
    html
    <div id=”$CHART$” style=”width: 100%; height: 500px;”></div>

    <script src=”/resources/dataloader/dataloader.min.js”></script>
    js
    var chart = AmCharts.makeChart(“$CHART$”, {
    “type”: “xy”,
    },

    “dataLoader”: {
    “url”: “data/data1.json”,
    “showErrors”: true,
    “complete”: function ( chart ) {
    console.log( “Loading complete” );
    },
    “load”: function ( options, chart ) {
    console.log( “File loaded: “, options.url );
    },
    “error”: function ( options, chart ) {
    console.log( “Error occured loading file: “, options.url );
    },
    “reload”: 120,
    “async”: true
    },

    });

    function reloadData() {
    chart.dataLoader.loadData();
    chart.validateData();
    }
    serial chart:
    html
    <div id=”chartdiv” style=”width: 100%; height: 500px;”></div>

    <script src=”/resources/dataloader/dataloader.min.js”></script>

    <input type=”button” value=”New Data” onclick=”reloadData();” />
    js
    var chart = AmCharts.makeChart(“chartdiv”, {
    “type”: “serial”,

    “dateFormat”: “DD-MM-YYYY HH:NN”,

    “dataLoader”: {
    … as first chart …
    },

    });

    function reloadData() {
    chart.dataLoader.loadData();
    chart.validateData();
    };

    chart.addListener(“dataUpdated”, zoomChart);
    zoomChart();
    function zoomChart(){
    chart.zoomToIndexes(chart.dataProvider.length – 20, chart.dataProvider.length – 1);
    }
    pie 3d chart
    html
    <div id=”$CHART$” style=”width: 100%; height: 500px;”></div>

    <script src=”/resources/dataloader/dataloader.min.js”></script>
    js
    var chart = AmCharts.makeChart(“$CHART$”, {
    “type”: “pie”,
    “theme”: “light”,

    “dataLoader”: {
    … as before …
    },

    “valueField”: “value”,
    “titleField”: “country”,
    “pulledField”: “pulled”,
    “outlineAlpha”: 0.4,
    “depth3D”: 15,
    “balloonText”: “title<br><span style=’font-size:14px’><b>value</b> (percents%)</span>”,
    “angle”: 45,
    “export”: {
    “enabled”: true
    }
    } );
    function reloadData() {
    chart.dataLoader.loadData();
    chart.validateData();
    };
    The last thing used for upload charts is this function
    function reloadData() {
    var NewChartData = [];
    NewChartData = chart.dataLoader.loadData();
    NewChartData.push(JSON.parse());
    chart.dataProvider = NewChartData;
    chart.validateData();
    };
    Is also loaded from the. json file and from the. php file (more precisely from the buffer), but only once when opened from the WordPress Admin panel.
    Automatically and when you click on the button they still do not update, ie shudder, but do not change. The data differs only by values, even the file size is identical.
    I need another type of chart to do, which in the examples are not, but since these are not updated, did not go further.
    Thank you for responding to my problem and offering help.

    Plugin Author martynasma

    (@martynasma)

    Sorry for not being able to get back earlier.

    chart.dataLoader.loadData() should take care of everything, including updating dataProvider and triggering validateData().

    Try removing those calls to see if they are interfering.

    Also, try adding timestamp: true to dataLoader configuration, to see if maybe we need to beat cache.

    Finally, are there any errors displayed in console when reload happens?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Charts are not updated’ is closed to new replies.