oxyplot / oxyplot-avalonia

A cross-platform plotting library for .NET. This package targets Avalonia apps.
https://oxyplot.github.io/
MIT License
274 stars 47 forks source link

line series order change base on XAxis value #36

Closed Naim-h closed 3 years ago

Naim-h commented 3 years ago

I have 3 Lineralseries and one AreaSeries, I need to show the AreaSeries behind of the LineSeries, this is my Xaml code: <oxy:Plot.Series> <oxy:AreaSeries Items="{Binding Measurements}" Fill="#EDCFAD" Color="Transparent" Color2="Transparent" ZIndex="-100" DataFieldX="Time" DataFieldY="Value0" DataFieldX2="Time" DataFieldY2="Value1"></oxy:AreaSeries>

<oxy:LineSeries Items="{Binding PointSeriesRef}" MarkerType="None" DataFieldX="Time" DataFieldY="Value0" MinimumSegmentLength="1" Color="Orange" BrokenLineColor="#ff0400"></oxy:LineSeries>

<oxy:LineSeries Items="{Binding PointSeriesAct}" MarkerType="None" DataFieldX="Time" DataFieldY="Value0" MinimumSegmentLength="1"></oxy:LineSeries>

<oxy:LineSeries Items="{Binding PointProgress}" MarkerType="None" DataFieldX="Time" DataFieldY="Value0" StrokeThickness="5" MarkerStrokeThickness="4" MinimumSegmentLength="1" Color="#5FF45D"></oxy:LineSeries> </oxy:Plot.Series>

the problem is base on the Xaxis value, the order of the Series changed and AreaSeries masked other line series. image

the correct output is this one image

the only difference is Maximum value of XAxis. Also I tried to fixed the series order by ZIndex but it's not working.

VisualMelon commented 3 years ago

This looks like the same problem as #35 which is due to a bug in Avalonia with sorting (fixed but awaiting release).

Also I tried to fixed the series order by ZIndex but it's not working.

Do you mean you tried the workaround mentioned in https://github.com/oxyplot/oxyplot-avalonia/issues/35#issuecomment-891970970 and it is still going wrong? If so, feel free to post your workaround code, and I'll check it over, but it may be that there is an issue with using XAML specifications with which I am unfamiliar.

VisualMelon commented 3 years ago

Should be fixed now that we target Avalonia 0.10.7.