Incorrect X values of data points in line series

4 posts, 0 answers
  1. Edward
    Edward avatar
    18 posts
    Member since:
    Oct 2010

    Posted 09 Dec 2010 Link to this post

    Hi,

    Our users have discovered that the X values of data points in line series charts are not always correct. See attached picture of a simple plot of 7 data points. The labels are correct, but notice that the points (2,2), (5,4) and (6,6) are not in the correct position on the X axis.

    I hope you agree that incorrectly-plotted data is a serious issue - if this is a bug please fix urgently. Apologies if we are doing something wrong in the chart setup. The chart was created using the following simple XAML:

    <telerik:RadChart Height="480" HorizontalAlignment="Left" Name="chart" VerticalAlignment="Top" Width="640" />

    And the following code behind:

    public MainPage()
    {
        InitializeComponent();
     
        chart.SeriesMappings.Add(CreateSeriesMapping());
        chart.ItemsSource = CreateSeries();
     
        chart.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;
        chart.DefaultView.ChartArea.AxisX.MinorGridLinesVisibility = Visibility.Visible;
        chart.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
        chart.DefaultView.ChartArea.AxisY.MinorGridLinesVisibility = Visibility.Visible;
    }
     
    private SeriesMapping CreateSeriesMapping()
    {
        SeriesMapping seriesMapping = new SeriesMapping();
        LineSeriesDefinition lineSeriesDefinition = new LineSeriesDefinition();
        lineSeriesDefinition.ItemLabelFormat = "#X, #Y";
        seriesMapping.SeriesDefinition = lineSeriesDefinition;
     
        seriesMapping.ItemMappings.Add(new ItemMapping("Key", DataPointMember.XValue));
        seriesMapping.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
     
        return seriesMapping;
    }
     
    private List<KeyValuePair<int, int>> CreateSeries()
    {
        List<KeyValuePair<int, int>> series = new List<KeyValuePair<int, int>>();
        series.Add(new KeyValuePair<int, int>(0, 1));
        series.Add(new KeyValuePair<int, int>(2, 2));
        series.Add(new KeyValuePair<int, int>(1, 3));
        series.Add(new KeyValuePair<int, int>(5, 4));
        series.Add(new KeyValuePair<int, int>(3, 5));
        series.Add(new KeyValuePair<int, int>(6, 6));
        series.Add(new KeyValuePair<int, int>(4, 7));
        return series;
    }

    It seems that there is difficulty whenever a data point's X value is less than the previous data point's X value. I even wondered whether the line is able to go "backwards" at all - we have managed to do this, but with interesting results (e.g. the same position in the graph being labelled twice!).

    Regards

    Ed
  2. Edward
    Edward avatar
    18 posts
    Member since:
    Oct 2010

    Posted 09 Dec 2010 Link to this post

    Just to say that we have worked around this by simply sorting the series by X value. Fortunately we actually have a scatter chart so the order of the data points doesn't matter - the workaround wouldn't be valid for a line chart.

    Ed
  3. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 14 Dec 2010 Link to this post

    Hello Edward,

     This bug has been fixed in our weekly builds and it should be out with SP1.

    All the best,
    Evgeni "Zammy" Petrov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  4. Edward
    Edward avatar
    18 posts
    Member since:
    Oct 2010

    Posted 14 Dec 2010 Link to this post

    Many thanks indeed for the quick response.

    Regards

    Ed
Back to Top