Page 1 of 1

Axis ZPosition property

Posted: Fri Jul 21, 2006 12:51 am
by 9338026
One of the things that we're doing with the custom axes in our application is placing them at the correct location for 0 along the other axis.

Previously we could achieve this with this code:

Code: Select all

    
    LeftAxis.PositionUnits:=muPixels;
    LeftAxis.PositionPercent:= series1.calcXPosValue(0) - tchPlotChart.chartRect.left;
Now that we're taking the depth axis into account, we'll also need to set the ZPosition property. It seems that the ZPosition can't be set using muPixels. Is that correct, or is there a way to do this?

If not, then we'll need to change to start using muPercent (for both positionPercent and ZPosition, to be consistent). We are reluctant to do that, because we don't want to be making any assumptions about how TChart converts muPixels back into the correct coordinates - ie, does does the percentage calculation change when the chart is zoomed/rotated?

My first assumption is that I can use a calculation like this:

Code: Select all

    
    LeftAxis.PositionUnits:=muPercent;
    LeftAxis.PositionPercent:= round (100 * ( (0-BottomAxis.minimum) / (BottomAxis.maximum - BottomAxis.minimum));
    LeftAxis.ZPosition:=round (100 * ( (0-DepthAxis.minimum) / (DepthAxis.maximum - DepthAxis.minimum));
(of course, the assumes all axis.mimumum values are <=0)

Would this be correct in all cases? Are there any other factors that come into play when using the percentages?

Posted: Mon Jul 24, 2006 11:16 am
by Pep
Hi David,
the ZPosition property. It seems that the ZPosition can't be set using muPixels. Is that correct, or is there a way to do this?
You're correct, muPixels cannot be used for ZPosition. we'll add on our wish list for further releases.
TChart converts muPixels back into the correct coordinates - ie, does does the percentage calculation change when the chart is zoomed/rotated?
This should not affect.
Would this be correct in all cases? Are there any other factors that come into play when using the percentages?
It seems a fine to me (calculate it as you've done).