How can I plot all axis labels ?
By default, axes try to avoid label overlapping by hiding some labels so there is
enough space to plot the rest.
You can disable this automatic "anti-overlapping" feature by setting the
LabelsSeparation property to zero:
TChart1.Axis.Bottom.Labels.Separation = 0
Other techniques to avoid overlapping
could be setting the axis labels rotation angle to 90 degree to make them vertical:
TChart1.Axis.Bottom.Labels.Angle = 90
Small values
on the axes do not show properly.
The default formatting string for axis labels is this: #,##0.###
When you have very small values ( like for example : 1E-09 ), the above formatting string
returns always the same format, as the values precision is more than 3 decimals ( ### ).
So, changing it to a suitable formatting
specifier (like 0.################## ) or setting it to empty will show the labels
correctly.
How can I re-scale Label intervals on a Date Axis on
Zooming the Chart in Visual Basic ?
TeeChart won't automatically adjust the stepping interval for Labels but you can
use the OnZoom and OnUndoZoom events to adjust Labelling.
Assume we have a Chart with these Label characteristics:
With TChart1.Axis.Bottom
.ExactDateTime = True
.Increment = TChart1.GetDateTimeStep(dtOneMonth)
.Labels.DateTimeFormat = "mmm-yyyy"
End With
...and we want to modify the Label interval if the
Zoom area is less than 31 days. Put the following code in the OnZoom event.
Private Sub TChart1_OnZoom()
With TChart1.Axis.Bottom
If .Maximum - .Minimum <31 Then 'eg. less than a month .'
.Increment="TChart1.GetDateTimeStep(dtOneWeek)"
.Labels.DateTimeFormat="dd-mmm-yyyy"
End If
End With
End Sub
How do I set up my own Logarithmic labelling scheme ?
Specific Logarithmic labels need to set with the OnGetNextAxisLabel.
eg.
Assuming this data:
TChart1.Series(0).Add 0.002, "", clTeeColor
TChart1.Series(0).Add 0.0035, "", clTeeColor
TChart1.Series(0).Add 0.005, "", clTeeColor
TChart1.Series(0).Add 0.007, "", clTeeColor
Setup the Axis:
TChart1.Axis.Left.Logarithmic = True
TChart1.Axis.Left.TickOnLabelsOnly = True
TChart1.Axis.Left.SetMinMax 0.001, 10
New in TeeChart Pro v5 ActiveX Control
is the ability to display axis labels in exponent format with super-script
fonts. This is especially useful when created logarithmic Charts and can be
achieved with the following two lines of code:
TChart1.Axis.Left.Labels.Exponent = True
TChart1.Axis.Left.Labels.ValueFormat = "00e-0"