Axis labels
The main axis label provides the name for ILAxis. The name is displayed next to the axis line and automatically moves with the cube's rotation.
Configuring axis labels
Axis labels are accessed by the Label property of ILAxis. For example, to set the
label's text for the X axis of an ILPanel ('panel') to "X Label" in a red, bold font, use
the following statements:
panel.Axes.XAxis.Label.Text = "X Label";
panel.Axes.XAxis.Label.Font = new Font("Arial",10.0f, FontStyle.Bold);
panel.Axes.XAxis.Label.Color = Color.Red;
ILAxisLabel provides the following members, which are used to configure display
properties for the label.
| Property | Description |
|---|---|
Alignment | Align the label along the axis line. |
Color | Color for the label |
Font | Font for the label |
Padding | Spacing around the label |
Text | Label text |
Positioning the label
The Alignment property determines where to place the label along the main axis line. Possiblie values are contained
in the AxisLabelAlign enumeration:
Centercenters the label between minimum and maximum value,Upperplaces the label near the upper axis limit andLowerplaces the label near the lower axis limit.
Oversized labels
Axis labels are nicely prepared to render more than small text elements. The text for axis labels can span
multiple lines, even very long lines are supported. However, you are responsible to manually place line
breaks into the text. ILAxis automatically finds the optimal position for the label to fit into the
controls bounds. If a nice location cannot be found, the label's orientation (horizontal/vertical) will also be adjusted.
The following example demonstrates, how to configure axis labels properties: text,font, color,size,alignment and padding. The X axis label is very large and spans multiple lines. For testing, run the example, enter some text in the textbox and move the camera by dragging the cube with the mouse. Watch the label dynamically changing position and/or orientation.
// configure X label
ILAxisLabel label = m_panel.Axes.XAxis.Label;
label.Color = Color.Green;
label.Font = new Font("Times New Roman",12.0f,FontStyle.Italic);
label.Text = "Change me in the textbox!";
label.Alignment = AxisLabelAlign.Lower;
// configure Y label
label = m_panel.Axes.YAxis.Label;
label.Font = new Font("Courier",08.0f,FontStyle.Regular);
label.Text = "Y label";
label.Alignment = AxisLabelAlign.Upper;
label.Padding = 20;

Download the complete example as VS2005 solution here.