Jump to content
Software FX Community

Performance


CalsepDK
 Share

Recommended Posts

Hi

I have created a derived chart control. This control is used to display data both real time and static. The static performance is top notch and so is real time updating as long as I have less than approx. 1000 points after which updating happens slower and slower until comming to a complete stop with the entire UI freezing. As soon as the simulation (which is sending the output points to the chart) has finished, the chart is updated and shows the entire output correctly (meaning it has received the remaining output points).

The simulation is running on a seperate thread from the UI. The way I add points to the plot in real time is using the standard API (NoOfNewPoints is typically around 5 since I want the chart to update often).

If (Me.Data.Points < .PlotList.Count) Then

Me.Data.Points = .PlotList.Count + 10

End If

For j As Integer = 0 To NoOfNewPoints - 1

Me.Data.X(index, PointCount + j) = .XCoordinateValue(PointCount + j)

Me.Data.Y(index, PointCount + j) = .YCoordinateValue(PointCount + j)

Next

I don't know how many output points will be generated by the simulation, so I expand it a little by little (it makes no real difference how much I add at a time). I have tried looking into the real time API, but I can't get it to work properly. I tried the following:

Me.RealTime.BeginAddData(NoOfNewPoints, RealTimeAction.Append)

For j As Integer = 0 To NoOfNewPoints - 1

Me.Data.X(index, 0) = .XCoordinateValue(PointCount + j)

Me.Data.Y(index, 0) = .YCoordinateValue(PointCount + j)

Next

Me.RealTime.EndAddData(False, False)

But this never updates the chart with anything. I have tried setting the BufferSize, but it doesn't change anything (and I wouldn't know the exact number anyhow).

I have tried changing AntiAliasing, DoubleBuffering, AggressiveAllocation, marker size and shape, but it really doesn't change anything. The problem seems to become worse (meaning the behaviour will kick in sooner than 1000) if more than one chart is updating in real time.

Any suggestions is appreciated. Is the real time API the way to go if I want this kind of behaviour and if so, how in #

Link to comment
Share on other sites

Like all Windows From control, ChartFX is Apartment threaded, only the UI thread can make calls to it. You have to use Control.Invoke in order to access properties and methods of the chart from another thread.

For more information on this please check MSDN docs on Control.Invoke and Control.BeginInvoke.

I don't know if this is the only issue you are facing but it is definitely one of them. Please attach a sample program that reproduces the "slow" behavior if you want us to direct you on what changes to make.

Link to comment
Share on other sites

I am fully aware of the threading issue and that is not the problem (I am using BeginInvoke), otherwise the update without the real time API wouldn't work either (and I would get an error, not just slow performance).

Producing a sample will be difficult, since the behaviour is part of a very big solution, but I will see if I can reproduce it in a smaller sample. In the mean time, do you have any suggestions to a possible solution. I am still at loss as to how I can get the real time API to work, but would you expect this to change anything (it is not that many points I am trying to plot)?

Regards

...Henrik

Link to comment
Share on other sites

I really don't know what's happening. Other than the samples provided in the resource center, without any specifics about your app there is really nothing else I can add at this point. Getting that application that reproduces the problem is key to determine the cause of the performance degradation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...