jQWidgets Forums

jQuery UI Widgets Forums Chart How to properly update chart with new data

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 12 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • olejl77
    Member

    I have a webserver providing a JSON string with data for a column chart. I need to update this data every ~5sec.

    If I do the following every 5 sec, the chart is updated, but I get a flickering every time it updates.

    var dataAdapter = new $.jqx.dataAdapter(source);
    $('#jqxChart').jqxChart({ source: dataAdapter });

    I have also tried the following, but flickering is still there:

    dataAdapter.dataBind();

    What is the proper way to solve this? Is there anything similar to the ‘updatebounddata’ also for jqxChart?


    Dimitar
    Participant

    Hello olejl77,

    Unfortunately, jqxChart does not support seamless dynamic refresh. You are updating the chart correctly.

    $('#jqxChart').jqxChart('refresh');

    is also an option. However it will still flicker on refresh.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    olejl77
    Member

    Thank you for the reply. I managed to get rid of the flickering using this function instead if the dataBind()

    function load_data() {
    $.getJSON(source.url, function(json) {
    for (var i=0;i<dataAdapter.totalrecords;i++)
    {
    dataAdapter.records[i].Value = json[i].Value;
    }
    $('#jqxChart').jqxChart('refresh');
    })
    }

    I still had to do the following but at least now it doesn’t flicker.

    $('#jqxChart').jqxChart('refresh');

    Is there a way to set a new value of a bar and it updates dynamically? I would like to ‘enableAnimations’, but when I enable it, the bar animates from zero and not from the previous value.


    Dimitar
    Participant

    Hi olejl77,

    Unfortunately, you cannot animate from the old value to the new value. Animation is from 0 to the new value.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.