How to Determine BottomAxis Maximum and Minimum Values

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
mf360v
Newbie
Newbie
Posts: 3
Joined: Fri Jul 17, 2015 12:00 am
Contact:

How to Determine BottomAxis Maximum and Minimum Values

Post by mf360v » Thu Jul 30, 2015 3:17 am

Hello,

I have a TDBChart with 25 dates values on the bottom axis. Points per page is set to 10. Regardless of what property I check, the maximum value NEVER returns 25 (or 24) - it's always "9". Among numerous attempts, I have tried the following:

dbChart1.Axes.Bottom.Maximum
DBChart1.MaxXValue(DBChart1.BottomAxis)
and
dbchart1.BottomAxis.Maximum

None of these tell me I have a total of 25 bottom axis values - every one of these returns 9. Seems like this should be pretty simple, so obviously I'm doing something wrong. How do I determine the number of bottom axis values (a.k.a. x-axis) values shown on the chart. Shouldn't a "Maximum" or "MaxXValue" property give me what I need. Instead, it seems to be giving me "MaxVisibleValues".

Thank you,

Mike

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: How to Determine BottomAxis Maximum and Minimum Values

Post by Narcís » Thu Jul 30, 2015 7:43 am

Hi Mike,

Yes, using latest TeeChart version available with the code snippet below I get what you request. Which TeeChart version are you using? Alternatively you could use Chart1.Series[0].Count.

Code: Select all

uses Series, Math;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D := False;
  Chart1.MaxPointsPerPage := 5;
  Chart1.AddSeries(TLineSeries.Create(Self)).FillSampleValues;
end;

procedure TForm1.Chart1Scroll(Sender: TObject);
begin
  Chart1.Axes.Bottom.Minimum := Max (Chart1.Axes.Bottom.Minimum, Chart1[0].MinXValue);
  Chart1.Axes.Bottom.Maximum := Min (Chart1.Axes.Bottom.Maximum, Chart1[0].MaxXValue);
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
Image Image Image Image Image Image
Instructions - How to post in this forum

mf360v
Newbie
Newbie
Posts: 3
Joined: Fri Jul 17, 2015 12:00 am
Contact:

Re: How to Determine BottomAxis Maximum and Minimum Values

Post by mf360v » Thu Jul 30, 2015 11:41 am

Hi Narcis,

Thanks for the reply, but I am not trying to set the maximum or minimum values. I am trying to determine what they are after the data has been plotted and chart has been drawn. Again, if the chart has 25 dates (or 30, or 100) shown on the bottom axis, I want to know the count of the number of dates.

After posting the original message I found "DBChart.GetMaxValuesCount()" which seems to return the correct count of the maximum number of values. Is this the method I should be using? That is, does GetMaxValuesCount() apply to the bottom axis?

By the way, the version I'm using is 2015.15.150420 (just downloaded and installed a few days ago).

Thank you,

Mike

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: How to Determine BottomAxis Maximum and Minimum Values

Post by Narcís » Thu Jul 30, 2015 11:52 am

Hi Mike,
mf360v wrote:I am trying to determine what they are after the data has been plotted and chart has been drawn. Again, if the chart has 25 dates (or 30, or 100) shown on the bottom axis, I want to know the count of the number of dates.
You can use TChartSeries.Count property.
mf360v wrote:After posting the original message I found "DBChart.GetMaxValuesCount()" which seems to return the correct count of the maximum number of values. Is this the method I should be using? That is, does GetMaxValuesCount() apply to the bottom axis?
GetMaxValuesCount returns the number of points of the Series with larger number of points. Only Series that are Active (visible) are considered. For example, if Series1 has 20 points, and Series2 has 50 points, and both are visible, this function returns 50.

If you use custom axis labels you could use Chart1.Axes.Bottom.Items.Count too.
mf360v wrote:By the way, the version I'm using is 2015.15.150420 (just downloaded and installed a few days ago).
Thanks, that's the last publicly available version.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply