TChart.Zoom event fired before some properties are updated
Posted: Tue Dec 16, 2014 8:59 am
TLineSeries: After a Zoom I want to react to the now displayed data range. I.e. I need to know then Series.FirstValueIndex/Series.LastValueIndex. But at least these two properties are within the TChart.Zoom event not yet set. a) Should this be considered as a bug? b) I mad a workaround by inserting Chart.Repaint within that event, which causes the properties to be updated. Is this ok, or is there another cleaner solution?
This is the code fragment showing the behaviour (the whole sample project is also attached):
This is the code fragment showing the behaviour (the whole sample project is also attached):
Code: Select all
procedure TForm6.Chart1Zoom(Sender: TObject);
begin
Chart1.Repaint; // Needed in order to have e.g. "Series1.FirstValueIndex", "Series1.LastValueIndex" updated
ShowValueIndexBounds;
end;
procedure TForm6.ShowValueIndexBounds;
begin
Self.Caption := Format('%d, %d', [Series1.FirstValueIndex, Series1.LastValueIndex]);
end;