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

Varying time period based on data

1 Answer 40 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Sam Cogan
Top achievements
Rank 1
Sam Cogan asked on 26 Mar 2013, 02:41 PM
I have a line chart that displays some data, this data is collected on a daily basis, so currently I have a chart point for each day. That works fine, however as this data increases I will have some  data sets with many weeks or months worth of data, where as others will only have a few days worth.

What I would like to do is have the chart deal with this dynamically, so if I have, say, over 4 weeks of data, then it should only plot a point for each week (and make this an average of the daily data for that week). If it is less than 4 weeks, plot a point for each day.

Is there an easy way to do this with the charting component, rather than having to pre -process the data before it gets there?

I am using the MVC wrapper.

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 28 Mar 2013, 01:37 PM
Hi,

The date axis can be configured to behave in the manner you describe using the maxDateGroups option:
categoryAxis: {
    type: "date",
    baseUnit: "fit",
    maxDateGroups: 100
}


It will aggregate the data in such time intervals that the total number of points remains below [maxDateGroups]. The intervals it chooses from are defined in autoBaseUnitSteps.

If you're dealing with a lot of data points (say 10 000) you should consider doing aggregates on the server. We do this in the stock chart virtualization demo.

The server-side grouping code is located in the ASP.NET MVC package:
wrappers\aspnetmvc\Examples\Controllers\DataViz\Financial\VirtualizationController.cs

In fact, the stock chart is an extension built on top of the regular chart widget. It does not limit you to financial series and will happily plot line charts as well. You can use it directly if you need interactive selection.

Greetings,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Sam Cogan
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or