I finally had some time to look at the TeeChart source. I now have a better understanding of how RotateLabel works (it is overloaded, with or without a Z parameter) and I also realized there is a Calc3DPos method. So here is what seems to work (in the AfterDraw event handler):
Code: Select all
SX = TChart1.Axes.Right.Position
If TChart1.Axes.Right.Labels.Align = Steema.TeeChart.AxisLabelAlign.Default Then
SY = TChart1.Series(26).CalcYPosValue((TChart1.Axes.Left.Maximum + TChart1.Axes.Left.Minimum) / 2) - (TChart1.Graphics3D.TextWidth(TChart1.Axes.Right.Title.Text) / 2)
TChart1.Graphics3D.Calc3DPos(SX, SY, CInt(TChart1.Aspect.Width3D * TChart1.Axes.Right.ZPosition * 0.01))
TChart1.Graphics3D.RotateLabel(SX + TChart1.Axes.Right.MaxLabelsWidth + (g.FontHeight / 2), SY, TChart1.Axes.Right.Title.Text, 270.0)
Else
SY = TChart1.Series(26).CalcYPosValue((TChart1.Axes.Left.Maximum + TChart1.Axes.Left.Minimum) / 2) + (TChart1.Graphics3D.TextWidth(TChart1.Axes.Right.Title.Text) / 2)
TChart1.Graphics3D.Calc3DPos(SX, SY, CInt(TChart1.Aspect.Width3D * TChart1.Axes.Right.ZPosition * 0.01))
TChart1.Graphics3D.RotateLabel(SX - TChart1.Axes.Right.MaxLabelsWidth - (g.FontHeight / 2), SY, TChart1.Axes.Right.Title.Text, 90.0)
End If
Note that I am using the existing TeeChart properties fo the title text, zposition, and alignment, but I have the Title.Visible property set to false. Also, as I mentioned before, the reference to series 26 to find the y position is simply to find the midpoint of the vertical axes. I will eventually change that to something more generic in case there aren't 27 series on the chart.
I thought about changing the TeeChart source for displaying the axis title and recompiling, but I don't thave the full version of Visual Studio on my PC, just Visual C# 2008 Express Edition (it can't handle the Pocket2005 part of the project). Is there any possibility that Steema could change the code for displaying the axis title to include these (or similar) modifications in a future release?
Jay