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

Message ListMessage List     Post MessagePost Message

  Long refresh delays...
Posted by chuck on Sep-03-2020 01:42
Hello Peter,

You have been very helpful answering all my questions regarding my project... I have an issue I hope you can help me with... I’m sure the problem is on my side, so hoping you have a solution that I have not implemented but need to...

In short, after drawing Trendlines on a OHLC Style Chart, it takes a tremendous amount of time to refresh the chart... basically, he entire UI locks up until the Chart completes.

Assuming the Charts are using the UI thread... so hoping there is a simple way to resolve this performance issue... double buffering, different thread... what can you recommend? If you also have a VB.NET example, that would be helpful to me as well.

If you need more than this generic info, please reply with specifics and I’ll be happy to answer.

Thank you!
Chuck

  Re: Long refresh delays...
Posted by Peter Kwan on Sep-03-2020 15:15
Hi Chuck,

It is not normal for the chart to take a long time to refresh. Even for a chart with a million data points, it should take less than 1 second to refresh.

In cases with large number of data points, the image map (the tooltips) itself can take significant amount of time. If you are using getHTMLImageMap, try comment out that line to see if it makes any difference. (Track cursors can be more efficient for large number of data points.)

Without your complete code and data, it is hard to determine what is the cause of the problem. Is it possible to modify one of the sample code that comes with ChartDirector by adding your "trend line" there to reproduce the problem? You can then email the code to me at pkwan@advsofteng.net or attach it to your next message.

You can certainly draw the chart in a worker thread. Only the GUI (the Chart Viewer) needs to be in the UI thread. The chart itself can be rendered in any thread.

In the worker thread, you can create the chart object (eg. FinanceChart object) as normal. Note that you have to ensure everything you use in the worker thread is thread safe. For example, your data must work in multi-threading environment, and you probably already know you cannot use any GUI controls in a non-GUI thread.

After creating the FinanceChart, add one more line:

// Force the chart to render in the worker thread
myFinanceChart.makeChart2(Chart.BMP)

Then pass the myFinanceChart to the UI thread to run the code:

myChartViewer.setChart(myFinanceChart)

Regards
Peter Kwan