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

Message ListMessage List     Post MessagePost Message

  Update Line without updating chart
Posted by Medic89 on Oct-04-2021 19:54
I have a multichart called "alles". Now i'd like to add a vertical line, that represents the current time. Is there a way, to update only the line without the actual diagram? I have a timer which updates every minute, but if I create the line together with the chart and update the whole chart every minute, the performance decrease is massive...

int FarbeZeit = alles->dashLineColor(0xCC00FF, Chart::DashLine);
        alles->addLine(c->getXCoor(ZeitJetzt())+30, 50, c->getXCoor(ZeitJetzt())+30, (GrenzeUnten+89+Scrollen), FarbeZeit,2);

  Re: Update Line without updating chart
Posted by Peter Kwan on Oct-05-2021 14:46
Hi Medic89,

For your case, the fastest and simplest method is to redraw the entire chart. The performance impact is negligible. That means you do not need to write any additional code to "update" the line, as you already have the code draws the entire chart.

ChartDirector includes sample code that updates the chart with millions of data points 10 times per second, with interactive zoom and scrolling and track cursors. The performance is fine.

You can certainly add lines to the chart. The issue is that you are not adding the line. You can "updating", which means we need to remove the old line as well. The old line overwrites some pixels. To be able to remove it, we must remember and keep track of the pixels that are overwritten by the old line and restore it. The "Programmable Track Cursor" examples that come with ChartDirector demonstrates how to do this. It is usually for chart that needs to update complicated things very fast (eg. as fast as the mouse moves). If you only need to update once per minute, it is not necessary.

Regards
Peter Kwan