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

Scatter plot with a 3rd value reprensented by color

1 Answer 173 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Sigfredo
Top achievements
Rank 1
Sigfredo asked on 24 Dec 2018, 01:34 AM

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

 

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 25 Dec 2018, 08:42 AM
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.
Tags
ChartView
Asked by
Sigfredo
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or