Controlling the y axis range while paging
Controlling the y axis range while paging
I have a DBChart with integer values on the y axis and dates on the x axis. I have many points and have defaulted to having 10 points per page. I have the left axis min max set to automatic. The problem is that the numbers vary greatly from 1 to 3000. I would like to be able to set the left axis range based on the min and max values based on the points on the page as the user pages through the DBchart.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi McMClark,
Yes, you can achieve that doing something like this:
Yes, you can achieve that doing something like this:
Code: Select all
procedure TForm8.Chart1AfterDraw(Sender: TObject);
var
locMin,locMax: double;
i: Integer;
begin
locMin := Series1.YValues.Value[Series1.FirstValueIndex];
locMax := locMin;
for i := Series1.FirstValueIndex+1 to Series1.LastValueIndex do
begin
if Series1.YValues[i] < locMin then locMin := Series1.YValues[i];
if Series1.YValues[i] > locMax then locMax := Series1.YValues[i];
end;
With Chart1.Axes.Left do
begin
Automatic := false;
SetMinMax(locMin,LocMax);
Chart1.Repaint;
end;
end;
procedure TForm8.ChartPageNavigator1ButtonClicked(Index: TTeeNavigateBtn);
begin
Chart1.Draw;
end;
procedure TForm8.FormCreate(Sender: TObject);
begin
Chart1.Draw;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |