# Axes

The 3D space in the **RadCartesianChart3D** control is defined by three axes, one for each dimension – X, Y and Z. Currently, there are a couple of axis types that can be used with the 3D chart - **LinearAxis3D** and **CategoricalAxis3D**.

> caption Axes

![WPF RadChartView3D Axes](https://www.telerik.com/products/wpf/documentation/assets/7d68b3c578c2ab72865ad52d89a4b1e3/radchartview-3d-axes-0.png)

## Common Features

The linear and categorical 3D axes share some common features which you can find listed below.

* **Labels visibility**: You can control the visibility of the axis labels using the **ShowLabels** bool property.

  **Example 1: Setting the labels visibility**

  ```XAML
  <telerik:LinearAxis3D ShowLabels="False"/>
  ```

> caption The labels of all axes are hidden

```
![WPF RadChartView3D The labels of all axes are hidden](images/radchartview-3d-axes-1.png)
```

* **Label interval**: You can set the interval between the visible labels of the axis using the **LabelInterval** property. This allows you to display labels only at a specific step.

  **Example 2: Setting the label interval**

  ```XAML
  <telerik:LinearAxis3D LabelInterval="2" />
  ```

> caption Label interval

```
![WPF RadChartView3D Label interval](images/radchartview-3d-axes-2.png)
```

* **Label style**: You can define a custom style for the axis labels using the **LabelStyle** property. The property accepts an object of type Style that targets a **TextBlock** element.

  **Example 3: Setting the label style**

  ```XAML
  <telerik:LinearAxis3D>
      <telerik:LinearAxis3D.LabelStyle>
          <Style TargetType="TextBlock">
              <Setter Property="Foreground" Value="#CA5100" />
              <Setter Property="FontWeight" Value="Bold" />
          </Style>
      </telerik:LinearAxis3D.LabelStyle>
  </telerik:LinearAxis3D>
  ```

> caption Label style

```
![WPF RadChartView3D Label style](images/radchartview-3d-axes-3.png)	
```

* **Label template**: You can create a **DataTemplate** that defines the appearance of the axis labels and set it to the **LabelTemplate** property of the axis.

  **Example 4: Setting the label template**

  ```XAML
  <telerik:LinearAxis3D>
      <telerik:LinearAxis3D.LabelTemplate>
          <DataTemplate>
              <Grid Margin="2">
                  <Rectangle Fill="#2DB245" Width="16" Height="16" />
                  <TextBlock Text="{Binding}" Foreground="White" TextAlignment="Center"/>
              </Grid>
          </DataTemplate>
      </telerik:LinearAxis3D.LabelTemplate>
  </telerik:LinearAxis3D>
  ```

> caption Label template

```
![WPF RadChartView3D Label template](images/radchartview-3d-axes-4.png)

> The data context passed to the LabelTemplate is an object of type `System.Double` when the axis is LinearAxis3D. In case CategoricalAxis3D is used, the data context is `System.Object` which contains the corresponding category provided by the series' items.
```

* **Ticks length**: You can define the length of the axis ticks using the **MajorTickLength** property.

  **Example 5: Setting the label template**

  ```XAML
  <telerik:LinearAxis3D MajorTickLength="15"/>
  ```

> caption Tick length

```
![WPF RadChartView3D Tick length](images/radchartview-3d-axes-5.png)
 
```

* **Plot mode**: You can set the strategy for positioning the data points along the axis using the **PlotMode** property of the axis.

  **Example 6: Setting the plot mode**

  ```XAML
  <telerik:CategoricalAxis3D PlotMode="BetweenTicks"/>
  ```

  The PlotMode property can have the following values:

  * **BetweenTicks**: The data points are plotted between each two adjacent ticks.
  * **OnTicks**: The data points are plotted over each tick.
  * **OnTicksPadded**: The data points are plotted over each tick with half a step applied on both ends of the axis.

> caption Plot modes

```
![WPF RadChartView3D Plot modes](images/radchartview-3d-axes-6.png)
```

* **Title**: The **Title** property allows you to display a heading positioned next to the axis. To customize the title appearance you can use the **TitleTemplate** property.

  **Example 7: Setting the axis title**

  ```XAML
  <telerik:CategoricalAxis3D Title="Axis title"/>
  ```

> caption Axis title

`````
![WPF RadChartView3D Axis title](images/radchartview-3d-axes-7.png)	

__Example 8: Setting the axis title template__
````external-docs-snippet radchartview3d-axes-example_8_setting_the_axis_title_template-xaml
````
`````

> caption Axis title template

```
![WPF RadChartView3D Axis title template](images/radchartview-3d-axes-8.png)	
```

* **Smart labels**: You can avoid labels overlapping with the smart labels strategy of the axis. To enable this feature you can use the **SmartLabelsMode** property.

  **Example 9: Enabling the axis smart labels**

  ```XAML
  <telerik:CategoricalAxis3D SmartLabelsMode="SmartStep"/>
  ```

> caption Smart labels mode

```
![WPF RadChartView3D Smart labels mode](images/radchartview-3d-axes-9.png)
```

* **Line style**: You can modify the appearance of the lines drawn for the axes by creating a style which targets the **Path** type and set it as the **LineStyle** property of the axis.

  **Example 10: Enabling the axis smart labels**

  ```XAML
  <telerik:LinearAxis3D>
      <telerik:LinearAxis3D.LineStyle>
          <Style TargetType="Path">
              <Setter Property="Stroke" Value="Red" />
              <Setter Property="StrokeThickness" Value="3" />
          </Style>
      </telerik:LinearAxis3D.LineStyle>
  </telerik:LinearAxis3D>
  ```

> caption Styled lines of the Z axis

```
![Styled lines of the Z axis](images/radchartview-3d-axes-13.png)
```

## LinearAxis3D

This type of axis has a notion of range which means that it has minimum, maximum and a numeric step between its values. The axis can be used to plot numeric data. You can find the axis specific features listed below.

* **Desired tick count**: You can use the **DesiredTickCount** property of the axis to set the number of the desired ticks that will be displayed on the axis. Note that the property doesn’t set a fixed number of ticks, but it defines the preferred count and the chart tries to calculate them accordingly.

  **Example 11: Setting the desired tick count**

  ```XAML
  <telerik:LinearAxis3D DesiredTickCount="3" />
  ```

* **Manual range**: You can use the **Minimum** and **Maximum** properties of the axis to set the range manually. To control the step between the ticks you can use the **MajorStep** property.

  **Example 12: Setting manual range**

  ```XAML
  <telerik:LinearAxis3D Minimum="0" Maximum="10" MajorStep="2.5" />
  ```

> caption Manual range

```
![WPF RadChartView3D Manual range](images/radchartview-3d-axes-10.png)
```

* **Tick origin**: The axis tick positions are determined by the **MajorStep** and the **TickOrigin** properties. The ticks will be generated such that a tick is positioned at the given TickOrigin.

  **Example 13: Setting the axis tick origin**

  ```XAML
  <telerik:LinearAxis3D Minimum="0" Maximum="10" MajorStep="2.5" TickOrigin="5"/>
  ```

> caption Tick origin

```
![WPF RadChartView3D Tick origin](images/radchartview-3d-axes-11.png)	
```

* **Label format**: You can use the LabelFormat property to format the values of the axis labels.

  **Example 14: Setting the axis label format**

  ```XAML
  <telerik:LinearAxis3D LabelFormat="P0"/>
  ```

> caption Label format

```
![WPF RadChartView3D Label format](images/radchartview-3d-axes-12.png)	
```

* **Actual range**: Use the **ActualRange** property of LinearAxis3D to get the actual data range of the axis (auto-generated or coming from the Minimum and Maximum properties).

  **Example 15: Get the actual range of the axis**

  ```C#
  ValueRange<double> actualRange = this.linearAxis3D.ActualRange;
  ```

  When the range changes, the **ActualRangeChanged** event fires.

  **Example 16: ActualRangeChanged event handler**

  ```C#
  private void LinearAxis3D_ActualRangeChanged(object sender, Telerik.Charting.NumericalRangeChangedEventArgs e)
  {
      ValueRange<double> oldRange = e.PreviousRange;
      ValueRange<double> newRange = e.NewRange;
  }
  ```

## See Also

* [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radchartview3d/getting-started)
* [Camera Behavior](https://www.telerik.com/products/wpf/documentation/controls/radchartview3d/features/behaviors/camerabehavior)
* [PointSeries3D](https://www.telerik.com/products/wpf/documentation/controls/radchartview3d/series/pointseries3d)
* [BarSeries3D](https://www.telerik.com/products/wpf/documentation/controls/radchartview3d/series/barseries3d)
* [SurfaceSeries3D](https://www.telerik.com/products/wpf/documentation/controls/radchartview3d/series/surfaceseries3d)
