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

[Solved] Aggregation

3 Answers 77 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Olaf
Top achievements
Rank 1
Olaf asked on 02 Feb 2013, 12:40 AM
Hi,

There's a great example of chart aggregation for the Windows 8 HTML chart control here:

http://www.telerik.com/help/windows-8-html/chart-show-sales-per-period.html

Is there a similar method available to let a barseries perform aggregation in the XAML controls?

I'm using a RadCartesianChart with a horizontal DateTimeCategoricalAxis. Although the DateTimeCategoricalAxis has an 'autogroup' property, this doesn't perform aggregation so doesn't summarize the values on the vertical axis.

Thanks,

Olaf

3 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 04 Feb 2013, 01:46 PM
Hello Olaf,

Thank you for your interest.

RadChart does not provide aggregates functionality out-of-the-box so you will need to pre-process the data prior to passing it to the control. Alternatively you can achieve something similar with DateTimeCategoricalAxis and customized stacked Bar series like this but note that it will work only as a substitute for Sum aggregation:

XAML
<telerik:RadCartesianChart x:Name="RadChart1">
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:DateTimeCategoricalAxis DateTimeComponent="Year" LabelFormat="{}{0:yyyy}" />
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis />
    </telerik:RadCartesianChart.VerticalAxis>
 
    <telerik:BarSeries CombineMode="Stack">
        <telerik:BarSeries.DefaultVisualStyle>
            <Style TargetType="Border">
                <Setter Property="BorderBrush" Value="Transparent" />
                <Setter Property="Background" Value="Orange" />
            </Style>
        </telerik:BarSeries.DefaultVisualStyle>
    </telerik:BarSeries>
</telerik:RadCartesianChart>

C#
var series = RadChart1.Series[0] as BarSeries;
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2008/02/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 5.3 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2008/05/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 5 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2008/08/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 6.3 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2008/11/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 10 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2009/02/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 4.8 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2009/05/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 4.5 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2009/08/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 5.5 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = DateTime.ParseExact("2009/11/01", "yyyy/MM/dd", CultureInfo.InvariantCulture), Value = 8.7 });

You can also log your feature request in our public ideas&feedback portal here. Hope this helps.

 

All the best,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Olaf
Top achievements
Rank 1
answered on 05 Feb 2013, 08:46 AM
Hi Ivaylo,

I've used the 'ComebineMode="Stack"' property in combination with a DateTimeCategoricalAxis and grouping by week, month or year but the control doesn't perform a sum aggregation. Instead it is showing the maximum value within the period. Is this expected behavior?

Thanks,

Olaf 
0
Accepted
Ivaylo Gergov
Telerik team
answered on 05 Feb 2013, 11:31 AM
Hello Olaf,

Sorry for misleading you a bit with my previous reply. Indeed the suggested workaround with stacked series will not work with the current version of the control but with the next official version that is scheduled around mid-February.

For the time being you will need to preprocess and aggregate the data manually prior to passing it to the chart control.

 

Greetings,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart for XAML
Asked by
Olaf
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Olaf
Top achievements
Rank 1
Share this question
or