problem with band

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

problem with band

Post by fredd41 » Tue Oct 24, 2017 4:08 pm

hi

I've been trying to fix a problem for several months, but I think it's on your side.

When I move a band over a segment containing FreeformPointLineSeries, if the segment has a certain height or width, the band move slowly or quickly.

Please check my videos. In the quick version, the band follow my mouse cursor. In the slow version, there is a delay between my mouse and the band position.
It's very disturbing for my users.

The code is exactly the same in both examples. Here it's a spectrum, each FreeformPointLineSeries represents a color (10 colors).

http://www.gel.usherbrooke.ca/audio/spi/slow.mp4
http://www.gel.usherbrooke.ca/audio/spi/quick.mp4

thanks

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: problem with band

Post by ArctionKestutis » Wed Oct 25, 2017 10:11 am

Hello,

Thank you for the post, but there is not enough details to reproduce the issue.
Could you send the sample of your application for testing to Arction's support account [support at arction dot com].
If you could not share you application, please tell that is important elements to reproduce the problem: number of segments, minimum amount of series, type of series (e.g. IntesityGridSeries), are you dragging band or band's values updated on MouseMove Event, what are problematic height/width (segment or window)?
Which one is FreeformPointLineSeries? Is it the red and blue traces?
Please also include version number of LightningChart you are using and edition (WinForms, WPF, bindable).

All the best.

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Wed Oct 25, 2017 1:58 pm

I found the problem.
it becomes slow when I change the dimensions of the points of a FreeformPointLineSeries.
If points are set to (1,1), it's very fast. But otherwise it's slow.

my current code : (very slow)
For Each f As FreeformPointLineSeries In chart.ViewXY.FreeformPointLineSeries
Dim w = CSng(SegmentWidth() / (CurrentZoom.Width / st.Z.SampleWidth))
If w <> f.PointStyle.Width Then f.PointStyle.Width = w

Dim h = SegmentHeight() / st.Z.SamplesPerFrame
If h <> f.PointStyle.Height Then f.PointStyle.Height = h
Next

then I tried this (very fast):
For Each f As FreeformPointLineSeries In chart.ViewXY.FreeformPointLineSeries
f.PointStyle.Width =1
f.PointStyle.Height = 1
Next

But I need to put the real values, otherwise I see the background between points.

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: problem with band

Post by ArctionKestutis » Thu Oct 26, 2017 7:23 am

Hello,

Sorry but we still don't have enough details to reproduce your issue. You did not answered questions I asked in previous message.
- Version number of LightningChart you are using and edition (WinForms, WPF, bindable)?
- Where FreeformPointLineSeries is used? Is it Heatmap (middle segment) build from points of 10 FreeformPointLineSeries?
- Could you share your application with us?
- Other important information how to reproduce issue.

All the best.

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Thu Oct 26, 2017 2:02 pm

Version number of LightningChart : last winform version
Could you share your application with us : no, it's too big with a lot of requirements
Where FreeformPointLineSeries is used? Is it Heatmap (middle segment) : yes, the spectrum of the first curve

10 FreeformPointLineSeries : yes,

the spectrum has 1024 rows x 1500 columns x 10 colors
the first curve is a wave signal (SampleDataSeries) 150 s x 48 000 hz
I use a band to zoom into the chart with mousedown, mousemove and mouseup events.
After zooming, I have to resize each point (10 FreeformPointLineSeries) to cover the entire segment
Example :
freeformseries1.pointstyle.height = segment.height / 1024
freeformseries1.pointstyle.width = segment.width / currentzoom.width

The problem is when there is a lot of points in FreeformPointLineSeries and you set dimensions for each series (with pointsoptimization = none),
there is a big delay between a click and the chart mousedown event.

With pointsoptimization = lotsofpixels, it's faster but I cannot resize each point when I zoom into the curve (pointstyle.height and pointstyle.width are disable).

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: problem with band

Post by ArctionKestutis » Fri Oct 27, 2017 9:12 am

If I understood you right you are using 10 FreeformPointLineSeries with probably 1024 points to create HeatMap (Spectrogram).
Even if you using just this small amount of points, IntensityGridSeries is more efficient than rendering thousands of Point-rectangles. We very much encourage you to use IntensityGridSeries (if distance between nodes is not fixed you can use IntensityMeshSeries).
There are many examples in our Demo App about HeatMaps. Those include examples "Audio L+R, area, spectrograms" (analysis of audio file spectrum on fly), "Spectrogram" and "High-resolution spectrogram" (both show the fastest and most optimal way to present frequently updating spectrum).
However, it seems that in you app Spectrogram (Heatmap) is static. Therefore, for you maybe easier will be to test example "Intensity grid mouse control". This example allow to change Grid-size and some of the settings. If you want fast rendering of this kind of grid, please enable 'Pixel map' (PixelRendering property). This should be close to view you build from FreeformPointLineSeries. On my PC, interaction with 3000x3000 intensity grid (enabled PixelRendering) is very fast.

Are there is special reason, why you are using FreeformPointLineSeries instead of IntensityGridSeries?

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Mon Oct 30, 2017 1:05 pm

No, I have 10 FreeformPointLineSeries with 1024x1500 points .
My wave signal has 150 seconds (1024x10 points per second)

If I try your Intensity grid mouse control example with 1024 x 1500, it's very slow

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: problem with band

Post by ArctionKestutis » Mon Oct 30, 2017 3:21 pm

Did you ticked checkbox 'Pixel map' (enabled PixelRendering property) on example "Intensity grid mouse control"?
Could you share the DxDiag output from your machine (as mine middle range PC show no problem)? Could you tell what is the main reason for slow IntensityGrid (is short of memory or CPU power)? For example, with ‘Process Explorer’ (https://technet.microsoft.com/en-us/sys ... lorer.aspx ) you should be able to investigate it.

I am still not sure, which approach I should optimize. I could try to compare both, but it would be good to know how you build your Spectrogram. Could you share the code how you create Heatmap from FreeformPointLineSeries ? Do you have single points (from only one of 10 series) at any given 1024x1500 location, or series overlap?

All the best.

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Mon Oct 30, 2017 4:25 pm

ok your example is faster with pixel map checked but you don't have a band like me.

I replaced my code with intensity grid (pixelrendering=true) but it's still slow

When I try to move my band over the chart, there is a delay between the mouse cursor and the band position.
If I remove the intensity grid, it's very fast

http://www.gel.usherbrooke.ca/audio/spi/slow.mp4 (with intensity grid - second segment)
http://www.gel.usherbrooke.ca/audio/spi/quick.mp4 (without intensity grid)

The band doesn't react the same way, but it's the same code behind.


Chart.RenderOptions.LineAAType2D = LineAntiAliasingType.ALAA
Chart.RenderOptions.DeviceType = RendererDeviceType.AutoPreferD11
Chart.RenderOptions.AntiAliasLevel = 1

Public Sub Chart_MouseDown(sender As Object, e As MouseEventArgs)
Try
With Chart
If e.Button = MouseButtons.Left AndAlso Control.ModifierKeys = Keys.None Then
If .ViewXY.IsMouseOverGraphArea(e.X, e.Y) = False Then Return
ChartAction.Selecting = True
Dim position As Double
XAxis.CoordToValue(e.X, position, True)
band.ValueBegin = position
band.ValueEnd = position
If band.Visible = False Then band.Visible = True
.Options.AllowInternalMouseCursorChange = False
.Cursor = Cursors.VSplit
For Each y As AxisY In .ViewXY.YAxes
If y.MouseInteraction <> False Then y.MouseInteraction = False
Next
For Each series As SampleDataSeries In .ViewXY.SampleDataSeries
If series.MouseInteraction = True Then series.MouseInteraction = False
Next
End If
End With
Catch ex As Exception
ErrorHandler(ex)
End Try
End Sub

Public Sub Chart_MouseMove(sender As Object, e As MouseEventArgs)
Try
With Chart
If e.Button = MouseButtons.Left AndAlso Control.ModifierKeys = Keys.None Then
If ChartAction.Selecting = True Then
Dim position As Double
XAxis.CoordToValue(e.X, position, True)
band.ValueEnd = position
End If
End If
End With
Catch ex As Exception
ErrorHandler(ex)
End Try
End Sub

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Mon Oct 30, 2017 4:28 pm

dxdiag page 1
Attachments
dxdiag1.jpg
dxdiag1.jpg (104.58 KiB) Viewed 25599 times

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Mon Oct 30, 2017 4:28 pm

dxdiag page 2
Attachments
dxdiag2.jpg
dxdiag2.jpg (98.51 KiB) Viewed 25599 times

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Mon Oct 30, 2017 4:32 pm

my intensity grid code


Dim grid = New IntensityGridSeries(.ViewXY, XAxis, st.Y.Axis)

grid.ShowInLegendBox = False
grid.Title.Visible = False
grid.ValueRangePalette = CreatePalette(st.Z.Minimum, st.Z.Maximum)
grid.FullInterpolation = True
grid.SetRangesXY(0, st.Info.Duration, st.Y.Minimum, st.Y.Maximum)
grid.SetSize(st.Z.NumberOfFrames, st.Z.SamplesPerFrame)
grid.Tag = New MyTag("3D", st.Y.Axis.Tag.ToString)
grid.pixelrendering = true
.ViewXY.IntensityGridSeries.Add(grid)



Dim data = New IntensityPoint(st.Z.NumberOfFrames - 1, st.Z.SamplesPerFrame - 1) {}
For j = 0 To st.Z.NumberOfFrames - 1 Step 1
For i = 0 To st.Z.SamplesPerFrame - 1 Step 1
Dim k As Double = st.Series.SamplesDouble(i + (st.Z.SamplesPerFrame * j))
data(j, i).Value = k
Next
Next
grid.Data = data

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Mon Oct 30, 2017 4:52 pm

check my cpu usage with and without intensity grid:

http://www.gel.usherbrooke.ca/audio/spi/slow_cpu.mp4 (with intensity grid - second segment)
http://www.gel.usherbrooke.ca/audio/spi/quick_cpu.mp4 (without intensity grid)

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Mon Oct 30, 2017 6:07 pm

and there is a bug in your intensity grid mouse example.

check pixel map
move slowly the cursor inside the chart by the top or by the right

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: problem with band

Post by ArctionKestutis » Tue Oct 31, 2017 12:00 pm

Thanks for all the details. Now I manage to build test application and replicate the issue. Indeed looks like a bug as any object (Band, LineSeriesCursor or EventMarker) would moves slowly above visible IntensityGrid. Disabling MouseInteraction for grid helps a little bit, but probably not significantly.
At the moment we don't know other workaround but to make grid smaller.

We will fix it as soon as possible.
Sorry for inconvenience.
All the best.

fredd41
Posts: 113
Joined: Fri Sep 05, 2014 6:46 pm

Re: problem with band

Post by fredd41 » Wed Nov 15, 2017 2:51 pm

Hi
I'm wondering if you found a problem about my bug.
thanks

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: problem with band

Post by ArctionKestutis » Thu Nov 16, 2017 9:26 am

Hi,

Yes, we found the issue behind slow movement of Band. The IntensityGrid draw-data have been excessively refreshed. We fixed issue and FPS go up 10 folds. The fix is scheduled for next release, which currently planned in the beginning of next month.
Sorry for inconvenience.

All the best.

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: problem with band

Post by ArctionKestutis » Wed May 23, 2018 6:26 am

Hi Frederick,

Issue has been fixed in version 8.2.1.4. Could you confirm the fix?

All the best.