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

[Solved] Line series displaying incorrectly with DateTimeCategoricalAxis

1 Answer 107 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.
Haroon
Top achievements
Rank 1
Haroon asked on 17 Jul 2013, 11:42 PM
I am trying to plot a line series chart with a date time categorical x axis and a linear y axis. The issue is that the lines are connected prior to the date time categorical axis sorting them chronologically. What ends up is that the points are connected they were added, instead of chronological order. 
LineSeries lineSeries = new LineSeries();
Chart.VerticalAxis = new LinearAxis();
 Chart.HorizontalAxis = new DateTimeCategoricalAxis() { PlotMode = AxisPlotMode.OnTicksPadded, DateTimeComponent = DateTimeComponent.Month, LabelFormat = "{0,0:MMM yy}" };
  
 foreach (var data in FormattedData.Values)
   {
     foreach (var key in data)
    {
            CategoricalDataPoint point = new CategoricalDataPoint();
            point.Value = string.IsNullOrEmpty(key.Value.Data) ? 0 : Convert.ToDouble(key.Value.Data);
 
            DateTime outDate;
           if (DateTime.TryParse(key.Key, out outDate))
             point.Category = outDate;
 
            lineSeries.DataPoints.Add(point);
 }
 }
Chart.Series.Add(lineSeries);

1 Answer, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 18 Jul 2013, 10:58 AM
Hello Haroon,

Thank you for using RadControls for Wondows 8!

I must admit that this is a bug with the RadChart control when using DateTimeCategoricalAxis - the points are connected in the order they are added to the DataPoints collection. I have forwarded this issue to our devteam for further review. As a workaround for the time being we can suggest you use pre-sorted collection of points.

Thank you for your valuable feedback. I have updated your Telerik points by 600 as a token of gratitude.

Regards,
Rositsa Topchiyska
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart for XAML
Asked by
Haroon
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or