Page 1 of 1
Align top and bottom axis grid/labels
Posted: Wed Jan 07, 2004 6:13 pm
by 9078925
Does anyone know how I could align the top axis labels and grid lines to match the bottom axis?
Posted: Wed Jan 07, 2004 7:06 pm
by Pep
Hi Graig,
you should set the same imcrement for both (top and bottom axis) :
TChart1.Axis.Top.Increment = X
TChart1.Axis.Bottom.Increment = X
Josep Lluis Jorge
http://support.steema.com
Posted: Wed Jan 07, 2004 9:23 pm
by 9078925
That won't work because they are different units. Plus, the increment has little influence on the interval of the labels themselves.
Any other ideas?
Posted: Fri Jan 09, 2004 9:10 am
by Pep
No, that I know of. The only way is to :
a) Make sure both axes have the same number of labels displayed. This can be done by setting axis increment property.
b) Both axes start labeling at the same position. This can be to some degree controlled by seting right axis minimum and maximum value.
All in all, not an easy task to do. Alternatively, you could simply hide right axis gridlines and you won't have duplicate gridlines.
Josep Lluis Jorge
http://support.steema.com
Posted: Mon Jan 12, 2004 5:33 pm
by 9078925
Here's my solution to this:
OnGetAxisLabel, I get the increment of the first bottom axis label relative to the max value, as a percentage. Then the second increment percentage, between the first label and next label.
Then, OnGetNextAxisLabel, I manually set each label for the top axis.
First Label = max - (Increment1Percentage*(max-min));
Every other label = Previous Label - (Increment2Percentage*(max-min));
Note that this is always based on the bottom axis, so the user can't change the scale of the top axis, that is the next step. And also allow the user to select number of ticks for both top and bottom axes.
Another little problem is that when axis is automatic, TeeChart returns the offset as '0', when it is not. So if the user changes anything, which switches automatic to off, the other axis is not aligned because it still has an offset.
Maybe in the future, TeeChart will fix these and make this process easier.