Hi,
IAxisLabels.Width & IAxisLabels.MaxWidth doesn't seem to return correct values when the labels are overridden with the OnGetAxisLabel event.
/ Fredrik
IAxisLabels.Width & IAxisLabels.MaxWidth
Hi Fredrik,
yes, you're correct , it's a bug/missing feature. I've added it on our defect/wish list to be considered for the next maintenance releases.
In meantime you can calculate it manually as in the following example :
yes, you're correct , it's a bug/missing feature. I've added it on our defect/wish list to be considered for the next maintenance releases.
In meantime you can calculate it manually as in the following example :
Code: Select all
Dim LWidth, MaxWidth As Integer
Private Sub Command1_Click()
MsgBox MaxWidth
End Sub
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
.AddSeries scLine
.Series(0).AddXY 0, 10, "aa", clTeeColor
.Series(0).AddXY 1, 13, "bb", clTeeColor
.Series(0).AddXY 2, 12, "cc", clTeeColor
.Series(0).AddXY 3, 3, "dd", clTeeColor
.Series(0).AddXY 4, 11, "ee", clTeeColor
LWidth = 0
MaxWidth = 0
End With
End Sub
Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
If Axis = 3 Then
If ValueIndex = 1 Then
LabelText = "Custom"
Else
LabelText = LabelText
End If
LWidth = TChart1.Canvas.TextWidth(LabelText)
If LWidth > MaxWidth Then
MaxWidth = LWidth
End If
End If
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com