This is a migrated thread and some comments may be shown as answers.

Line chart with date series not applying sum aggregate

3 Answers 88 Views
Charts
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 04 Dec 2013, 08:01 PM
I'm using a date series in a line chart with week and month groupings. It is currently displaying each point as what appears to be an average of data for that time period. I need it to display as a sum. 

Here is my initial chart code:

$("#overall-chart").kendoChart({
        title: {
            visible: false
        },
        dataSource: SPIData['trends']['dataUnfiltered'],
        legend: {
            visible: false
        },
        seriesDefaults: {
            aggregate: "sum"
        },
        series: updateSeries,
        valueAxes: valueAxes,
        valueAxis: {
            majorGridLines: {
                visible: false
            },
            minorGridLines: {
                visible: false
            },
            line: {
                visible: false
            }

        },
        categoryAxis: {
            majorGridLines: {
                visible: false
            },
            minorGridLines: {
                visible: false
            },
            majorTicks: {
                visible: false
            },
            minorTicks: {
                visible: false
            },
            //baseUnit: "months"
            baseUnit: bUnit
        },
        seriesClick: onSeriesClick,
    });

I have it set to swap out the chart to different data elements in the array using a radio, here is the push for that

        updateSeries.push({
            name: checkedVals[i],
            type: "line",
            axis: "metric",
            field: checkedVals[i],
            categoryField: "date",
            color: "#479ec2",
            aggregate: "sum"
        });


When I inspect in console I can see the options.series.aggregate is set to "sum", but it still does not show the summation on the chart. Is there something else I need to do?

3 Answers, 1 is accepted

Sort by
0
Iliana Nikolova
Telerik team
answered on 06 Dec 2013, 01:28 PM
Hi Greg,

By design Kendo UI Chart does not support dynamic changes of its configuration options and in order to achieve the expected result you should refresh the chart:
//get reference to the chart widget
var chart =  $("#chart").data("kendoChart");
//get chart options
var chartOptions = chart.options;
//add series
var updateSeries = chartOptions.series.push({
   //....
});
//refresh the chart
chart.refresh();

Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 06 Dec 2013, 04:32 PM
Iliana, 

I am already using chart.refresh(); following the code I supplied to you. The dynamic change is not the problem, the problem is I have sum set to begin with and it is not showing the points as a summation.
0
Iliana Nikolova
Telerik team
answered on 10 Dec 2013, 03:58 PM
Hello Greg,

I am not sure what causes the issue in your application - I tried to reproduce it but to no avail (jsBin example). Is it possible to provide an isolated runnable example which demonstrates the issue and which I can test locally? This way I would be able to check what exactly is going wrong and advice you further. Thank you in advance for your time and cooperation.

Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
David
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
David
Top achievements
Rank 1
Share this question
or