0
W trakcie analizy

Point at origin of AreaSeries

wl_joep 8 lat temu zaktualizowano 8 lat temu 3

Hello all,


Before adopting OxyPlot in our project, we used the example browser of the master branch to see if every feature we required was supported by OxyPlot. One of these features that we needed was drawing areas using a collection of points.

In order to verify whether this was possible, we adapted the example "AreaSeries with default style", so that the CreateExampleAreaSeries would return a looped series of points, by only using the Points collection (Points2 is left untouched).


private static AreaSeries CreateExampleAreaSeries()        
{
    var areaSeries1 = new AreaSeries();
    areaSeries1.Points.Add(new DataPoint(0.0, 1.1));
    areaSeries1.Points.Add(new DataPoint(1.0, 2.1));
    areaSeries1.Points.Add(new DataPoint(1.6, 1.6));
    areaSeries1.Points.Add(new DataPoint(1.6, 0.5));
    areaSeries1.Points.Add(new DataPoint(0.0, 0.5));
    areaSeries1.Points.Add(new DataPoint(0.0, 1.1));
    return areaSeries1;
}

When doing this, we got the behavior we required.

Now we are using the latest version of OxyPlot from NuGet, which is 1.0.0-unstable1953 and we notice that there is a point drawn at the origin. We can reproduce this using the example browser of the latest version and adapting the same example in the same way.

It is possible to work around this issue by adding a point from the Points collection to the Points2 collection.


So I'm wondering whether you can reproduce this and whether it is a bug or intentional?


Screenshot of possible bug:

Image 45


Thanks in advance.

It is possible to work around this issue by adding a point from the Points collection to the Points2 collection.
This workaround only works when adding points to the Points collection. When using the Itemsource and Mapping properties of the AreaSeries, it doesn't matter whether you add a point to the Points2 collection: it will draw a point at origin anyway.

Sorry for the late reply. When setting ConstantY2 to NaN, the area doesn't get a fill color. This can also be seen in the example library.


Perhaps a better solution would be to implement a Custom Series which supports my needs.