oxyplot / oxyplot

A cross-platform plotting library for .NET
https://oxyplot.github.io/
MIT License
3.24k stars 951 forks source link

Draw LineSeries anchor right (draw right-aligned) #1750

Open Nick135 opened 3 years ago

Nick135 commented 3 years ago

Feature description

Property to set the LineSeries anchor right (right-aligned).

Because of Poor performance, when the plot contains multiple Series with lots of Points, I only add the changed Points to the Series. This increase the performance very well. But then the LineSeries has different lenght (horizontal end positions).

This feature can also helpful, when you add the new Points event based on value changed.

The LiveChart project has this feature to draw the lines right-aligned.

Current: image

Feature: image

Nick135 commented 3 years ago

Other Image to show the need of the future

Plot with three line series image

VisualMelon commented 3 years ago

I'm not sure what you mean, or what the rationale is: could you elaborate on the use case?

Nick135 commented 3 years ago

@VisualMelon, in my last post you see how it is actually.

With the extension it should looks like this: image

Like a continuous line that only changes its Y position when a new point is added.

VisualMelon commented 3 years ago

Ah, I think I get it now. Is the idea that you might have multiple signal sources, but you only want to add a sample when they change (for efficiency reasons) but you want to indicate that the signal hasn't disappeared, it just hasn't changed?

I don't like the idea of extending the line to the edge of the plot: to make sense there would have to be some sort of threshold. I'm not convinced this would make sense in the library, but it should be easy (if something of a bodge) to implement it by extending LineSeries. I threw an implementation together which seems to work, but I've not really tested it: https://gist.github.com/VisualMelon/ea288e012923e5e94cb27c9001c35536

In this picture, the indicated 'points' don't really exist:

image


I don't think this makes sense for the existing LineSeries, it could make sense for a dedicated SignalSeries, which is something I've been contemplating doing for a while, but never had the need. I.e. something that allows you to explore looooong signals at any scale (e.g. by switching between min/max decimation and raw samples at various zooms) that requires a monotonic signal (LineSeries is already optimized for monotonic series, but I don't think it should contain behaviour specific to monotonic series).

VisualMelon commented 3 years ago

Linking #1748, because a well-designed monotonicity aware pre-decimator might help with performance.

Nick135 commented 3 years ago

Linking #1748, because a well-designed monotonicity aware pre-decimator might help with performance.

That's interesting, but I don't want to change how the signals looks like.

https://github.com/oxyplot/oxyplot/issues/1750#issuecomment-798878652 I imagine it to be like an oscilloscope or a trace. Maybe a TimeSeries is the better basis.

I will test your example.