-
Notifications
You must be signed in to change notification settings - Fork 985
Description
Hello,
I think I found a bug when I use AreaSeries and a custom DataPoint.
If I'm wrong please forgive me, this is the first alert I send.
I want to highlight this behaviour not happens with LineSeries.
Steps to reproduce
- Define a class named CustomDataPoint, with 3 fields: double X, double Y and int Z;
- create an array of CustomDataPoint and populate it;
- create an AreaSeries, then populate with an array of CustomDataPoint;
- associate the AreaSeries to a Plot, than look the results.
Platform
OxyPlot version: v2.1.2
OxyPlot RunTime version: v4.0.30319
.NET version: v4.7.2
Expected behaviour
Define a custom DataPoint named... CustomDataPoint, ok, in that way:
public class CustomDataPoint : IDataPointProvider
{
public double X { get; }
public double Y { get; }
public int Orig { get; }
public CustomDataPoint(double x, double y, int z)
{
X = x;
Y = y;
Z= z;
}
public DataPoint GetDataPoint()
{
return new DataPoint(X, Y);
}
}
Than, we create an AreaSeries variable with a specific TrackerFormatString, in that way:
AreaSeries LSTest = new AreaSeries() { Title="Hello Oxy!", Color = OxyColor.FromRgb(125,70,30) };
LSTest.TrackerFormatString = "Y: {4:0.#####}\nX: {2:0.#####}\nZ: {Z}";
Simple, isn't it?
Than, in the function/method we want to use it, create an array of CustomDataPoint in that way:
CustomDataPoint[] CdpTest = new CustomDataPoint[1000];
for(int i=0; i<1000; i++){
CdpTest[i] = new CustomDataPoint(FunctForX(x), FunctForY, i);
}
LSTest.ItemsSource = CdpTest;
PlotTest.Series.Add(LSTest);
So, when we click on the curve, we'll have in the Tooltip 3 infos:
- the X value;
- the Y value;
- the Z value, an incremental number in the interval [0 ... 999].
Results
We have that:
How to solve
You can solve it using LineSeries, not AreaSeries.
AreaSeries is a powerful tool when you have to compare 2 series: i.e. Baseline vs Current.
Don't trash it. Love it. Bugfix it.
