Series of different data point types

5 posts, 0 answers
  1. Jimmy
    Jimmy avatar
    3 posts
    Member since:
    Feb 2019

    Posted 12 Apr Link to this post

    I need to have multiple series in the same charts of different x axis types. I looked through the forum and so far the examples show multiple axis but they are always the same type like a linear series with categorical data points and a datetime continuous x axis. What I need is for one series to be a linear series with a datetime axis and another series to be a scatter line series with it's own x axis that takes proper doubles.
  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3219 posts

    Posted 16 Apr Link to this post

    Hello, Jimmy,    

    You can add a ScatterLineSeries and a LineSeries to the same RadChartView control. You can also specify the desired axis before adding the series to the RadChartView.Series collection. Please refer to the following help articles demonstrating how to add multiple axes:

    https://docs.telerik.com/devtools/winforms/controls/chartview/axes/datetime
    https://docs.telerik.com/devtools/winforms/controls/chartview/axes/multiple-axes

    The code snippet below shows how to achieve the result illustrated
    in the screenshot:
     
    ScatterLineSeries scatterSeries = new ScatterLineSeries();
    scatterSeries.DataPoints.Add(new ScatterDataPoint(15, 19));
    scatterSeries.DataPoints.Add(new ScatterDataPoint(18, 10));
    scatterSeries.DataPoints.Add(new ScatterDataPoint(13, 15));
    scatterSeries.DataPoints.Add(new ScatterDataPoint(10, 8));
    scatterSeries.DataPoints.Add(new ScatterDataPoint(5, 2));
    scatterSeries.PointSize = new SizeF(8, 8);
    this.radChartView1.Series.Add(scatterSeries);
     
    LineSeries series = new LineSeries();
    series.DataPoints.Add(new CategoricalDataPoint(6, DateTime.Now));
    series.DataPoints.Add(new CategoricalDataPoint(4, DateTime.Now.AddDays(1)));
    series.DataPoints.Add(new CategoricalDataPoint(7, DateTime.Now.AddDays(2)));
    series.DataPoints.Add(new CategoricalDataPoint(5, DateTime.Now.AddDays(3)));
    DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();
    categoricalAxis.DateTimeComponent = DateTimeComponent.Day;
    categoricalAxis.PlotMode = AxisPlotMode.BetweenTicks;
    categoricalAxis.LabelFormat = "{0:m}";
    series.HorizontalAxis = categoricalAxis;
    radChartView1.Series.Add(series);




    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Jimmy
    Jimmy avatar
    3 posts
    Member since:
    Feb 2019

    Posted 16 Apr in reply to Dess | Tech Support Engineer, Sr. Link to this post

    if I paste in the code above it works fine. However, if you switch the order of the series you get an error (attached). Most of the time the categorical series will be added first. Not last in my situation. The scatter series will be drawn in by mouse. I have it working for situations where the series is all numerical (scatter data point). but I need the solution to work for date time x axis as well. The requirements are that the data points drawn in does NOT have to be linear. In other words, they can draw a circle (if they really wanted) see the screenshot for the magenta series. The code only seems to specify an axis for the LineSeries object. is there one I can use for the scatter line series? I assume it creates a linear axis by default for that type. correct? Anyway thanks for the reply, I look forward to your help on this.
  4. Jimmy
    Jimmy avatar
    3 posts
    Member since:
    Feb 2019

    Posted 16 Apr in reply to Jimmy Link to this post

    just a sec - I think I see what I did wrong.. standby..
  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3219 posts

    Posted 17 Apr Link to this post

    Hello, Jimmy,     

    According to your last reply, I suppose that you have found a possible problem on your end. Take as much time as you need to further investigate it. However, I just would like to note that the DateTimeCategoricalAxis is relevant for DateTime values. But the ScatterDataPoint accept two numeric values. Feel free to use a LineSeries instead if you want to have a date axis.

    I am looking forward to your reply.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top