How to limit the chart to a fixed time span.
You may want to limit the chart to a specific date/time range while allowing the user to drag the chart within that range. To do this implement an OnDragPlot event handler:
procedure TForm1.RACDragPlot(Sender: TObject; var StartDateTime, EndDateTime: TDateTime); var span: TDateTime; begin // prevent the chart being scrolled outside a given range // FMinDate should be a TDateTime holding the earliest allowed date/time // FMaxDate should be a TDateTime holding the latest allowed date/time span := EndDateTime - StartDateTime; if StartDateTime < FMinDate then begin EndDateTime := FMinDate + span; StartDateTime := FMinDate; end else if EndDateTime > FMaxDate then begin StartDateTime := FMaxDate - span; EndDateTime := FMaxDate; end; end;
Note: This event handler can be invoked many times a second while the user is dragging the chart. It is important that it completes quickly in order to maintain a responsive user experience.
Copyright © 2000-2010 Simon Armstrong. All Rights Reserved.


