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] |
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().
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.