ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Delay in Plotting(Urgent)
Posted by Amal V R on Apr-19-2011 22:53
Hi Peter,

I am doing a graph application in which there is graph which is multiline,each line has data values of length 2000 and maximum lines possible is 30.

Even when we draw single line chart with 2000 values ,statement WinChartViewer.Chart=chart is taking a delay 0f about 280 ms and setting image map takes around 80 ms. In this case delay is small so my GUI thread won't block. But when number of lines are increased to suppose 10 or 20 the delay taken is very large and GUI becomes non responsive until the rendering is completed.

Please suggest solution for following problems:

1. Is there any other way to update chart control from thread other than UI thread to improve UI response.

2. Please suggest me some alternative ways reduce time taken to display chart. (Other than taking aggregation)

Our client requested to improve the performance of displaying graph in our application. So immediate response is required.

I am attaching a test application with this post. In the application you can give a count 'n' and on button click it draws the graph(same data is added to the layer n times).

Please verify the code attached and suggest an optimum way to improve the GUI responsiveness.

Thanks in advance.

  Re: Delay in Plotting(Urgent)
Posted by Peter Kwan on Apr-20-2011 00:40
Hi Amal,

From my experience, creating the chart should be quite fast (for 2000 points on a 600 x 300 chart, should take much smaller than 280ms - probably in the tens of ms range). The speed depends more on the number of pixels, rather than the number of data points.

On the other hand, the CPU needed to create and process the image map depends on the number of data points. Creating an image map with 2000 hot spots is similar to creating 2000 small push buttons on your screen. The GUI may take sometime to create 2000 regions capable to receiving mouse events and tooltips.

To identify whether the image map is the cause of the problem, please remove the line with "getHTMLImageMap" to see if the chart is much faster, even with 30 x 2000 points.

(For some reasons, I cannot see any attachment in your post, so I cannot test myself. To include an attachment, please remember to use the "Browse" button to upload the file. Also, note that there is a 250 KB limit for uploading. If you cannot upload to the forum, you may email the test application to me at "pkwan@advsofteng.net".)

For your question:

(1) You can always create the chart and the image map in any thread you like. It does not need to be in the GUI thread. However, according to Microsoft .NET documentation, all controls (such as all Microsoft controls and ChartDirector controls) can only be used in the GUI thread. So you can "make" the chart and image map in any thread you like, then use Control.Invoke to set them to the control in the GUI thread. It is like (in C#)

//make the chart in any thread you like
c.makeChart();
.... now use Control.Invoke to set the chart into the WinChartViewer ....

string imageMap = c.getHTMLImageMap(....);
.... now use Control.Invoke to set the image map into the WinChartViewer ....

You may refer to "Control.Invoke" in Microsoft .NET documentation for more details.

(2) I think the performance should already be much quicker without the image map. If you need the image map, you can consider to display the chart first (without the image map). In this way, the chart will be displayed very quickly. You can delay creating the image map when the mouse is actually moving over the chart (in the mouse move event of the WinChartViewer control), because the image map is only required when there is mouse action on the chart.

Hope this can help.

Regards
Peter Kwan

  Re: Delay in Plotting(Urgent)
Posted by Amal V R on Apr-20-2011 11:50
Attachments:
Hi Peter,

I'm attaching the test application. Please check.
ChartRenedringTest.rar
ChartRenedringTest.rar

9.52 Kb