Bottom axis label increment issue

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Thomas
Newbie
Newbie
Posts: 10
Joined: Thu Nov 25, 2004 5:00 am
Location: Calgary, Canada
Contact:

Bottom axis label increment issue

Post by Thomas » Tue Feb 01, 2005 8:25 pm

In a chart with two series (one has several points, the other has perhaps two points), the bottom axis behavior is incorrect. This is most noticable when the x values are in the range of 0 to 1. The culprit seems to be the AnySeriesHasLessThan function, which causes CalcLabelsIncrement to return 1, resulting in just two axis labels (0 and 1). This get much worse when the actual values are perhaps between 0.2 and 0.8, where one will see absolutely no labels.
Commenting out the ill effect of AnySeriesHasLessThan seems to solve the problem.
I assume that there is a good reason to keep AnySeriesHasLessThan around, I just do not know how to fix it so it behaves with x values between 0 and 1 (or any other similar range).
Interestingly, the left axis doesn't come with the same shortcoming.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Feb 03, 2005 11:14 am

Hi, Thomas.

Yes, you're correct. A fix is to replace:

Code: Select all

if AnySeriesHasLessThan(MaxNumLabels) then
  result:=Math.Max(1,result);
with

Code: Select all

if (IRange>=1) and AnySeriesHasLessThan(MaxNumLabels) then
  result:=Math.Max(1,result);
If you don't have TeeChart source code you can also do it manually:
#1 : Check if axis range is less or equal to 1.0
#2 : if yes, manually set axis increment.
Marjan Slatinek,
http://www.steema.com

Thomas
Newbie
Newbie
Posts: 10
Joined: Thu Nov 25, 2004 5:00 am
Location: Calgary, Canada
Contact:

Post by Thomas » Thu Feb 03, 2005 10:09 pm

Thanks Marjan,
I knew that the AnySeriesHasLessThan was good for something, just had no time to figure out the details. Wil fix my source code :)

Post Reply