Skip to main content

TdxCustomChartControl.CancelUpdate Method

Re-enables change notifications and delays pending changes made in the Chart control or its diagrams after a BeginUpdate procedure call until the next data or setting change.

Declaration

procedure CancelUpdate;

Remarks

Every time you add or modify a diagram, title, or legend, or customize an appearance setting, the Chart control redraws its content to reflect the change. Enclose multiple content and appearance changes between BeginUpdate and EndUpdate procedure calls to avoid excessive redraw operations and improve performance.

BeginUpdate/CancelUpdate and Batch Changes

A BeginUpdate procedure call disables notifications and postpones all changes until an EndUpdate or CancelUpdate call. Unlike EndUpdate, the CancelUpdate procedure does not apply pending changes to the Chart control’s appearance. It only re-enables change notifications and the corresponding redraw operations. The Chart control applies pending changes made between BeginUpdate and CancelUpdate calls with the next data or appearance change.

Note

Ensure that every BeginUpdate procedure call is followed by an EndUpdate or CancelUpdate procedure call, even if an exception occurs. Otherwise, the Chart control’s UI remains frozen and unresponsive.

CancelUpdate Usage Scenarios

The CancelUpdate procedure is designed for the rare usage scenarios when you need to configure and populate the Chart control while it is invisible. The EndUpdate procedure forces massive data and layout recalculations in the UI thread that may take a noticeable amount of time and render the application UI temporarily unresponsive.

If the Chart control is invisible during this process, you may want to re-enable change notifications and delay the time-consuming apply changes operation until the next change made after a CancelUpdate procedure call. For example, this technique is helpful if you need to configure and populate the Chart control before your application displays it for the first time and avoid making the already visible application UI temporarily unresponsive.

See Also