Page 1 of 1

Series that are on the Page

Posted: Thu Nov 09, 2006 2:33 pm
by 9337074
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?

Posted: Mon Nov 13, 2006 2:10 pm
by Pep
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;