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

[Solved] Line Chart Multiple Series

1 Answer 145 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.
Jordan
Top achievements
Rank 1
Jordan asked on 28 May 2013, 06:42 PM
I have a 2 lists of Revenue objects.  I'm trying to get a chart to show April to April (no years) on the X Axis,  I want overlapping line charts not a X Axis thats Apr 2012 to April 2013.  It looks my line chart is all messed up because the 2013 series only have 5 entries.  Do i need blank entires for the other months?.   How can i do this?  What am I missing?

public class Revenue
{
    public decimal RevenueAmount { get; set; }
    public DateTime YearMonth { get; set; }
}


          
<chart:RadCartesianChart HorizontalAlignment="Stretch" VerticalAlignment="Stretch" PaletteName="DefaultDark" SelectionPaletteName="DefaultDarkSelected">
                      <chart:RadCartesianChart.Grid>
                          <chart:CartesianChartGrid MajorLinesVisibility="XY"></chart:CartesianChartGrid>
                      </chart:RadCartesianChart.Grid>
                      <chart:RadCartesianChart.VerticalAxis>
                          <chart:LinearAxis LabelStyle="{StaticResource LabelStyle}"></chart:LinearAxis>
                      </chart:RadCartesianChart.VerticalAxis>
                      <chart:RadCartesianChart.HorizontalAxis>
                          <chart:DateTimeCategoricalAxis MajorTickInterval="1" DateTimeComponent="Month" LabelFormat="{}{0,0:MMM}" LabelStyle="{StaticResource LabelStyle}"></chart:DateTimeCategoricalAxis>
                      </chart:RadCartesianChart.HorizontalAxis>
                      <chart:RadCartesianChart.Series>
                          <chart:LineSeries CombineMode="Cluster" ItemsSource="{Binding Spend.CurrentYearRevenuesByAccount}">
                              <chart:LineSeries.ValueBinding>
                                  <chart:PropertyNameDataPointBinding PropertyName="RevenueAmount"></chart:PropertyNameDataPointBinding>
                              </chart:LineSeries.ValueBinding>
                              <chart:LineSeries.CategoryBinding>
                                  <chart:PropertyNameDataPointBinding PropertyName="YearMonth"></chart:PropertyNameDataPointBinding>
                              </chart:LineSeries.CategoryBinding>
                          </chart:LineSeries>
                          <chart:LineSeries CombineMode="Cluster" ItemsSource="{Binding Spend.LastYearRevenuesByAccount}">
                              <chart:LineSeries.ValueBinding>
                                  <chart:PropertyNameDataPointBinding PropertyName="RevenueAmount"></chart:PropertyNameDataPointBinding>
                              </chart:LineSeries.ValueBinding>
                              <chart:LineSeries.CategoryBinding>
                                  <chart:PropertyNameDataPointBinding PropertyName="YearMonth"></chart:PropertyNameDataPointBinding>
                              </chart:LineSeries.CategoryBinding>
                          </chart:LineSeries>
                      </chart:RadCartesianChart.Series>
                      <chart:RadCartesianChart.Behaviors>
                      </chart:RadCartesianChart.Behaviors>
                  </chart:RadCartesianChart>

1 Answer, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 30 May 2013, 01:02 PM
Hi Jordan,

Thank you for contacting us.

I have attached a runnable sample application based on your guidelines that demonstrates how you can achieve the desired effect by adding blank entries for missing data in order to preserve the chronological order of the categories among multiple series. Note, also, that Cluster CombineMode is applicable only to bar series.

Hope this helps.

Regards,
Rositsa Topchiyska
Telerik
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
Jordan
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or