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

Message ListMessage List     Post MessagePost Message

  Realtime Finance chart jumping
Posted by ronen on Feb-26-2024 17:43
When I use ChartDirector MFC c++ Finance chart in Realtime mode, the chart updates every 2 seconds.
The user can select the time frame (for example, one hour ago) and the size of the bar (for example, 10 seconds or 20 seconds).
Every two seconds, I redraw the chart using the current frame from the database.(The old 2 seconds are deleted from the data and the new 2 seconds are added to the data).

The chart started jumping  up and down , I think because the yAxis had been changed, but I'm not sure

What can I do to solve this?

Thank you, Ronen

  Re: Realtime Finance chart jumping
Posted by Peter Kwan on Feb-27-2024 02:26
Hi Ronen,

From your description, I assume the plot area border does not move, but the axis label changes and the contents inside the plot area (the candlesticks or OHLC bars or lines) moves.

If the y-axis scale is automatically determined by ChartDirector, it is normal the y-axis scale will change for a real time chart. Even in our real-time chart sample code, the axis scale will change initially.

ChartDirector can only determine the y-axis scale based on the data. Initially, there are a few data points, so ChartDirector will choose an axis scale to fit those points. Later, as there are more and more data, it is possible some data points will overflow the axis range, so ChartDirector must change the axis scale to accommodate the new data points. Similarly, if some data points are deleted, part of the axis scale may be unnecessary and ChartDirector may reduce the axis scale. When the axis scale changes, the positions of all data points will change.

For many charts, after some time, the axis scale will stabilize. It is because it will be harder and harder for new data to "break" the top/bottom record.

In some applications, it may be possible to use a fixed axis range or predict the axis range even with no data. For example, in some application, the axis range must be 0 - 1. In this case, instead of automatically determine the axis range, you can set the axis range directly using Axis.setLinearScale. In this way, the axis range will not change.

If the cause of the problem is the change in axis scale, and you think the change is not reasonable, would you mind to clarify how the chart is changing in your case? In your code, you can save the chart as an image using BaseChart.makeChart. Please save all the charts an images with the filename containing a serial number (like myChart1.png, myChart2.png, ....). You can then attach the images in your message to help me understand the issues. If there are too many images, please email me at  (The file upload in the forum cannot exceed 250 Kbytes per file, so we may need to use email for large number of images in a zip file.)

Best Regards
Peter Kwan