Series that are on the Page

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
McMClark
Newbie
Newbie
Posts: 50
Joined: Thu Apr 15, 2004 4:00 am

Series that are on the Page

Post by McMClark » Thu Nov 09, 2006 2:33 pm

I have a dbchart with multiple series based on queries. The left axis has integers and the bottom axis has dates. I set up a ChartPageNavigator to show 10 points per page. Some series do not have dates for the all the dates of other series so some series are not on all pages. Is their a programmatic way to have the dbChart let me know what series are visible on the particular page the user is seeing after they press the ChartPageNavigator?

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Nov 13, 2006 2:10 pm

Hi,

one solution could be to iterate through all the Series (in the OnAfterDraw event) if the Series contains a XValue betweend the Min and Max value of the actual X Axis. You could use similar code to the following, including the for loop in the event :

Code: Select all

procedure TForm1.Series1AfterDrawValues(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 TForm1.FormCreate(Sender: TObject);
begin
Chart1.Draw;
end;

procedure TForm1.ChartPageNavigator1ButtonClicked(Index: TTeeNavigateBtn);
begin
Chart1.Draw;
end;

Post Reply