Page 1 of 1

PointLineSeries PointsVisible performance issue with large d

Posted: Sat Jun 24, 2017 5:27 pm
by Kenselting
I have a chart with a single PointLineSeries, displayed with no Line, Points only. The X axis is a DateTime.

The series has approximately 250k data points, most of them defined as NaN due to an underlying data issue: the series effectively has 5 data points that are not NaN.
While I can fix the underlying data issue, I am concerned with the fact it takes about a minute for the chart to draw, and any manipulation on the chart causes the UI to freeze for 30 seconds or more.

During the data load, I am using Begin/End-Update, and I have validated that changing the PointsOptimization setting seems to do nothing at all in my case.

I loaded another series with about 120k points with only a few NaNs in there, and did not experience any performance issue.

Anything you could point that I am doing wrong? Obviously fixing the underlying issue will help, but I do not *always* want to get rid of those NaNs as they do have a meaning... The case at hand (5 valid point over a pile of 250k) is a corner case only, but other series are liable to have thousands of NaN data points that are perfectly legitimate.

This is running on LCU/Winforms v8.0.1.4001

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Mon Jun 26, 2017 1:05 pm
by ArctionKestutis
Hello,

It seems that you not using LightningChart's DataBreaking feature, but instead rely on GPU handling of NaN values. Please see User's Manual chapter 6.22 for the details how to enable DataBreaking .

Another way to exclude specific X range is Scale breaks (User's Manual chapter 6.22). It may be useful for you app as well.

In any case update to latest version (currently 8.1.2.1) as we constantly improve performance and fix bugs.

All the best.

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Tue Jun 27, 2017 7:11 am
by ArctionKestutis
In addition, with so many points it is beneficial (for speed) to disable mouse interaction:

Code: Select all

Series.MouseInteraction = false;

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Tue Jun 27, 2017 8:03 pm
by Kenselting
Hi,

Thanks for getting back to me. I think I checked all the boxes you mentioned... Here is my code:

Code: Select all

                        var mos = new PointLineSeries(_chart.ViewXY, xAxis, _chart.ViewXY.YAxes[(int) seriesProperties.Axis])
                        {
                            PointsVisible = true,
                            LineVisible = false,
                            Points = itemData.Where(x => !double.IsNaN(x.Value)).Select(x => new SeriesPoint(xAxis.DateTimeToAxisValue(x.Time), x.Value, x.AuditStampId)).ToArray(),
                            PointStyle = new PointShapeStyle
                            {
                                BorderWidth = seriesProperties.SeriesMarkerStyle.Hollow ? 1 : 0,
                                GradientFill = Arction.WinForms.Charting.GradientFillPoint.Solid,
                                Color1 = seriesProperties.SeriesMarkerStyle.Hollow ? Color.Transparent : seriesColor,
                                BorderColor = seriesColor,
                                Width = seriesProperties.SeriesMarkerStyle.Size,
                                Height = seriesProperties.SeriesMarkerStyle.Size,
                                Angle = seriesProperties.SeriesMarkerStyle.Angle,
                                Shape = seriesProperties.SeriesMarkerStyle.MarkerType.TranslateToLcu(),
                            },
                            Title = new SeriesTitle
                            {
                                Text = seriesProperties.Label
                            },
                            MouseInteraction = false,
                            DataBreaking =
                            {
                                Enabled = true,
                                Value = double.NaN
                            },
                            CursorTrackEnabled = false,
                            ShowInLegendBox = seriesProperties.ShowInLegend,
                        };

                        _chart.ViewXY.PointLineSeries.Add(mos);

The addition I made that "saved" things is this for the Points definition:

Code: Select all

.Where(x => !double.IsNaN(x.Value))
As I was mentioning, without this filtering, performance is horrible...

Any thoughts?

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Wed Jun 28, 2017 1:01 pm
by ArctionKestutis
Hi,

Could you send whole project or test project, which reproduce the issue to Arction's Support account?

Did you try to subscribe to _chart.ChartError event and check warning/notification in the event handler?

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Wed Jun 28, 2017 4:04 pm
by Kenselting
Give me a few days to create a new, isolated project for this (the project is too large and depends o external resources, so I can't send it as is).
I looked at the ChartError event - only got the DPI awareness warning in there - which I fixed, of sorts - but no change in performance. No other errors or warning.

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Wed Jun 28, 2017 5:28 pm
by Kenselting
Hi - I created a sample solution that shows the problem.

In the form, you have the option to show the line, markers and filter NaNs (before creating the series).

You will see that the problem happens as soon as you want to show Markers and do not filter the NaNs.

I hope this helps anbd thank you in advance!

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Fri Jun 30, 2017 10:10 am
by ArctionKestutis
Hi,

Thank you for the project. The 50'000 NaN value in between few reasonable is really extreme case. Yes, we see huge drop in performance. It is still not understood that makes this performance drop compare to few thousands NaN points. We will investigate further and let you know.
Probably the best workaround is disable PointsVisible and add SeriesEventMarkers instead. E.g.:

Code: Select all

            var arrWitoutNAN = itemData.Where(x => !double.IsNaN(x.Value)).Select(x => new SeriesPoint(xAxis.DateTimeToAxisValue(x.Time), x.Value, x.AuditStampId)).ToArray();
            for (int i = 0; i < arrWitoutNAN.Length; i++)
            {
                SeriesEventMarker marker = new SeriesEventMarker(mos);
                marker.XValue = arrWitoutNAN[i].X;
                marker.YValue = arrWitoutNAN[i].Y;

                marker.Symbol = new PointShapeStyle
                {
                    BorderWidth = 0,
                    GradientFill = GradientFillPoint.Solid,
                    Color1 = Color.Black,
                    BorderColor = Color.Black,
                    Width = 5,
                    Height = 5,
                    Angle = 0,
                    Shape = Shape.Rectangle,
                };
                mos.SeriesEventMarkers.Add(marker);
            }
All the best.

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Sun Jul 02, 2017 10:34 am
by Kenselting
Thanks for your feedback - glad this could help you find an issue. In my specific case, my filtering "bypass" is adequate in that I'll allow the user to have EITHER the line OR the markers, so I can just filter those NaNs for cases when only markers are shown (and not for lines, where I do want to see the data breaks)

Re: PointLineSeries PointsVisible performance issue with lar

Posted: Tue Jul 04, 2017 7:33 am
by ArctionPasi
We made a preliminary optimization / fix for this performance issue. We'll need to run more tests but it seems we can include it in the next assembly pack or installer :)