About Scatter and Coloraxis
This discussion was imported from CodePlex
CSharpdevs wrote at 2014-05-14 19:06:
Hi,
I want to use scatter series with color axis but an error occurs this process. I investigated some examples and see following code. When i used this code, i recieve the error code "Cannot create an instance of the abstract class or interface". I tired use Linearcoloraxis instead of Coloraxis, the code is working but the colors of data points are same.
Thanks for helps.
No working:
var colorAxis = new ColorAxis{ Position = AxisPosition.Right, Palette = OxyPalettes.Hot(30),Minimum=0,Maximum=10,HighColor=OxyColors.Blue,LowColor=OxyColors.BurlyWood};
Working code:
var model = new PlotModel();
I want to use scatter series with color axis but an error occurs this process. I investigated some examples and see following code. When i used this code, i recieve the error code "Cannot create an instance of the abstract class or interface". I tired use Linearcoloraxis instead of Coloraxis, the code is working but the colors of data points are same.
Thanks for helps.
No working:
var colorAxis = new ColorAxis{ Position = AxisPosition.Right, Palette = OxyPalettes.Hot(30),Minimum=0,Maximum=10,HighColor=OxyColors.Blue,LowColor=OxyColors.BurlyWood};
Working code:
var model = new PlotModel();
var colorAxis = new LinearColorAxis{ Position = AxisPosition.Right, Palette = OxyPalettes.Hot(30),Minimum=0,Maximum=10,HighColor=OxyColors.Blue,LowColor=OxyColors.BurlyWood,Key="r"};
model.Axes.Add(colorAxis);
var s4 = new ScatterSeries {ColorAxis = colorAxis };
s4.MarkerType = MarkerType.Circle;
s4.BinSize = 10;
s4.Title = "renk";
s4.MarkerStrokeThickness = 1;
Random r=new Random();
s4.Points.Add(new ScatterPoint(3, 5, 10*r.NextDouble(),1));
s4.Points.Add(new ScatterPoint(5, 5, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(2, 4, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(3, 3, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(3, 2, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(3, 5, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(2, 2, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(1, 4, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(4, 3, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(0, 0, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
s4.Points.Add(new ScatterPoint(8, 8, 10 * r.NextDouble(), 1));
s4.XAxisKey = "X axis";
s4.YAxisKey = "Y Axis";
model.Series.Add(s4);
plot1.Model = model;
Customer support service by UserEcho