LineSeriesDefinition chart

2 posts, 0 answers
  1. Anne Lyon
    Anne Lyon avatar
    90 posts
    Member since:
    Jan 2010

    Posted 27 Jul 2010 Link to this post


    I have a Line chart where I map XValue and YValue using a class as the ItemSource. My problem is that the X Axis is always scaled as if the axis should be a category axis (i.e., point 1 plots at tickmark 1, point 2 plots at tickmark 2 etc.).
    What I need to plot is a scatter plot, i.e. point 1 with value 5 plots at x=5 and not x=1, point 2 with value 8 plots at x=8 and not x= 2.

    The code is as follows:
    SeriesMapping seriesMapping = new SeriesMapping();
    seriesMapping.SeriesDefinition = new LineSeriesDefinition();
    seriesMapping.ItemMappings.Add(new ItemMapping("AODate", DataPointMember.XValue));
    seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
    seriesMapping.ItemMappings.Add(new ItemMapping("Label", DataPointMember.Label));
    List<clsPlotData> data = new List<clsPlotData>();
    double minX = 5;
    double middleX = 8;
    double middle2X = 9;
    double maxX = 14;
    double minY = 1;
    double middleY = 3;
    double middle2Y = 8.5;
    double maxY = 2;
    data.Add(new clsPlotData(minX, minY, ""));
    data.Add(new clsPlotData(middleX, middleY, ""));
    data.Add(new clsPlotData(middle2X, middle2Y, ""));
    data.Add(new clsPlotData(maxX, maxY, ""));
    ctlRadChart.ItemsSource = data;

    with clsPLotData being this:
    public class clsPlotData
        public clsPlotData(double AOdate, double yValue, string label)
            this.YValue = yValue;
            this.AOdate = AOdate;
            this.Label = "X: " + AOdate.ToString() + "\nY: " + yValue.ToString();
        public double YValue
        public Double AOdate
        public string Label

    The chart produced is attached as a jpg. How coan I get the x axis to show data from 5 to 14 instead of point 1 to 4?

  2. Velin
    Velin avatar
    391 posts

    Posted 30 Jul 2010 Link to this post

    Hello Anne Lyon,

    Please, find attached a small working example demonstrating the desired scenario.

    Hope this will help.

    All the best,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top