jQuery UI Widgets Forums Chart Crash when "seriesGroups" and "source" updated

This topic contains 2 replies, has 2 voices, and was last updated by  kir_rik 9 years, 10 months ago.

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

  • kir_rik
    Participant

    Hello.
    I have a problem with updating “seriesGroups” and “source” properties of jqxChart simultaneously.

    I tried

        function ChartUpdate() {
            var da = getChartDataAdapter();
            var sg = getSeriesGroup();
            $('#jqxChart').jqxChart({ source: da });
            $('#jqxChart').jqxChart({ seriesGroups: sg }); //crush on this action
            $('#jqxChart').jqxChart('update');
        }
            $('#jqxChart').jqxChart({ seriesGroups: sg });//crush on this action
            $('#jqxChart').jqxChart({ source: da });

    $('#jqxChart').jqxChart({ seriesGroups: sg, source: da });//crush on this action anyway

    More Datails:

    Error:
    Unhandled exception … in jqxchart.core.js
    0x800a138f – JavaScript runtime error: Unable to get property ‘X’ of undefined or null reference
    Where X is xAxis.dataField value

    Chart Creation (shows the chart correctly):

        function CreateChart() {
    
            var da = getChartDataAdapter();
            var sg = getSeriesGroup();
    
            var settings = {
                //"title", "description", "showLegend", "showToolTips", "padding" and "titlePadding" removed from sample
                source: da,
                xAxis:
                {
                    dataField: 'RowName',
                    showGridLines: false
                },
                colorScheme: 'scheme01',
                seriesGroups: sg
            };
    
            $('#jqxChart').jqxChart(settings);
        };

    Results of getChartDataAdapter() and getSeriesGroup() is correct, but it’s to big and complex to post here. What matters – it’s changed a lot. I switch from 6 elements in each column to 1 freely, but switching from 1 element in each column to 6 gives me this error.

    Can you help me with this?


    Peter Stoev
    Keymaster

    Hi kir_rik,

    Currently jqxChart does not support dynamic updates of series groups.
    When you make changes to the seriesGroups and call ‘update’ it will try to reuse previous
    values so that it can run animation from previous value of a data point to the new value.
    This update method is specifically design so that you can make changes to the data but not to completely
    reconfigure the chart.
    If you want to reconfigure the chart with a different data source and series groups, you should call ‘refresh’ instead of ‘update’.
    The safest option is to pass the entire settings object the same way you do it during the initial creation of the chart. Also it might be useful to turn off the animations if you dynamically update the chart and call ‘refresh’

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    kir_rik
    Participant

    Thank you.
    I changed enableAnimations to false and used ‘refresh’ instead of ‘update’. It helps.

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

You must be logged in to reply to this topic.