LineSeries has bad performance with large amount of data due to `aliased=false` · Issue #1286 · oxyplot/oxyplot · GitHub
Skip to content

LineSeries has bad performance with large amount of data due to aliased=false #1286

@gotoh

Description

@gotoh

When plotting large amount of data (i.e. over 100k points) using LineSeries,
it has bad perfomance and showing up with long seconds delay.
(environment: .net 4.5.2 WindowsForms on Windows 7 (x64))

I figured out that this issue is due to rc.DrawClippedLine(..., aliased=false, ...)
in LineSeries.RenderLine().
Unfortunately aliased=false is hardcoded.

There is a workaround making delived class with overriding RenderLine().

public class MyLineSeries : LineSeries
{

    List<ScreenPoint> outputBuffer = null;

    public bool Aliased { get; set; } = true;

    protected override void RenderLine(IRenderContext rc, OxyRect clippingRect, IList<ScreenPoint> pointsToRender)
    {
        var dashArray = this.ActualDashArray;

        if (this.outputBuffer == null) 
        {
            this.outputBuffer = new List<ScreenPoint>(pointsToRender.Count);
        }

        rc.DrawClippedLine(clippingRect,
                           pointsToRender,
                           this.MinimumSegmentLength * this.MinimumSegmentLength,
                           this.GetSelectableColor(this.ActualColor),
                           this.StrokeThickness,
                           dashArray,
                           this.LineJoin,
                           this.Aliased,  // <-- this is the issue
                           this.outputBuffer);

    }
}

I made a test program to compare performance, attached.
CheckLineSeriesAliased.zip
Here is a result with 10k, 20k, 50k, 100k data / aliased=true or false.

length true false
10k 0.02[s] 0.36[s]
20k 0.04[s] 1.05[s]
50k 0.09[s] 8.51[s]
100k 0.19[s] 64.83[s]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions