I have a line graph with the x-axis as DateTime. I would like to be able to go to today's date in the graph when the window is first displayed. Is there an easy way to do this?
Thanks.
Go to Date
Hi alexiat,
Yes, you should set your bottom axis min and max manually. Here is a simple example:
Yes, you should set your bottom axis min and max manually. Here is a simple example:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var day: TDateTime;
i: Integer;
begin
Chart1.View3D := false;
Chart1.AddSeries(TLineSeries.Create(nil));
Chart1[0].XValues.DateTime := true;
(Chart1[0] as TLineSeries).Pointer.Visible := true;
day := Today - 100;
for i:=0 to 500 do
Chart1[0].AddXY((day + i), i*i);
Chart1.Axes.Bottom.SetMinMax(Today - 3, Today + 3);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |