Scatter plot with a 3rd value reprensented by color

2 posts, 0 answers
  1. Sigfredo
    Sigfredo avatar
    1 posts
    Member since:
    Feb 2018

    Posted 23 Dec 2018 Link to this post

    I would like to plot data on a scatter chart with 3 values, for example, x value (double type, frequency), y value (date/time, date and time) z value (double type, amplitude). z value having a color legend representing the value.  Something like the attached intensity plot.

    Thanks

     

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3903 posts

    Posted 25 Dec 2018 Link to this post

    Hello, Sigfredo,     

    By design, ScatterSeries in RadChartView plots its data upon two numerical axes. Scatter series identify the position of each ScatterDataPoint using two numerical values - XValue and YValue for the horizontal and vertical axes respectively, just like in the typical Cartesian coordinate system. It doesn't expect a third value.

    I can suggest you using a RadChartView together with a RadLinearGauge for the colored values ranges. Additional information about the RadLinearGauge is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/gauges/lineargauge/lineargauge

    In order to customize the scatter points according to the value it stores, once the chart is populated with the series, you can iterate the ScatterSeries.Children collection and specify the ScatterPointElement.BackColor according to your custom requirements. You can find below a sample code snippet how to color the scatter points with a different random color:

    ScatterSeries scatterSeries = new ScatterSeries();
    scatterSeries.Name = "";
    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, 12));
    scatterSeries.PointSize = new SizeF(8, 8);
    this.radChartView1.Series.Add(scatterSeries);
     
    Random rand = new Random();
     
    foreach (ScatterPointElement point in scatterSeries.Children)
    {
        point.BackColor = Color.FromArgb(rand.Next(0, 255), rand.Next(0, 255), rand.Next(0, 255));
    }

    I hope this information helps. 

    Merry Christmas 

    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