-
Notifications
You must be signed in to change notification settings - Fork 985
Closed
Labels
Description
Currently, every plot element is responsible for its own clipping. Many series use the DrawClippedXxx(...) extensions from the RenderingExtensions and that way sometimes set and reset clipping multiple times per render (example).
Also, when you render many Series sharing the same axes, it wouldn't really be necessary to set and reset clipping every time.
Since #1645, we have some potential to reduce the amount of calls to IRenderContext.PushClip(...) and IRenderContext.PopClip() by moving the responsibility for the clipping out of the Series and Annotations.
Specifically I propose to:
- Remove the
DrawClippedXxx(...)extensions - Make
SeriesandAnnotations completely oblivious to clipping - Set and reset clipping in
PlotModel.RenderAxes(...)andPlotModel.RenderAnnotations(...)respectively, avoiding setting and resetting where possible
Why would this be desirable?
- Depending on the platform there could be a more or less significant performance penalty involved with every clipping
- The file size of vector-based exports (especially SVG) can get bloated by many redundant clipping calls
- Rendering code in
SeriesandAnnotationscould be simplified in some places, as it wouldn't have to worry about clipping any more
Potential Problems
- Removal of the
DrawClippedXxx(...)extensions will involve some breaking changes for custom implementations. Sure, we could also just keep these, but I'd like to make people aware that they shouldn't be concerned with clipping anymore when implementing customSeries/Annotations. CandleStickAndVolumeSeries- this is a bit of a weird one, because really it's two series in one and therefore needs to set different clipping areas during rendering. I would suggest to do a (hacky) fix for now and mark this as obsolete... I think people should be better off using individualCandleStickSeriesandVolumeSeriesanyway.- (more might emerge once I refine the proof-of-concept implementation I currently have)
I will put together a PR soon so we can talk more specifically about the proposed changes.
VisualMelon