DevExpress Presentation API: ChartEx Axes
- 2 minutes to read
Charts API automatically creates chart axis objects once you add a series to the chart Series collection.
ChartEx supports only CategoryAxisEx and ValueAxisEx types. To access the chart axes, use the following properties:
- ChartEx.ArgumentAxis property to access the argument axis (X-axis).
- ChartEx.ValueAxis property to access the value axis (Y-axis).
- ChartEx.SecondaryValueAxis property to access the secondary value axis.
ChartEx series require different axis sets depending on the series type. For example, a Box and Whisker series requires an argument axis and a value axis, while a Sunburst series does not require axes. The following table lists the required axes for each series type:
| Series type | ArgumentAxis type | ValueAxis type | Secondary ValueAxis type |
|---|---|---|---|
| Box and Whisker | CategoryAxisEx | ValueAxisEx | - |
| Funnel | CategoryAxisEx | - | - |
| Histogram | CategoryAxisEx | - | - |
| Pareto | CategoryAxisEx | ValueAxisEx | ValueAxisEx |
| Filled Map | - | - | - |
| Sunburst | - | - | - |
| Treemap | - | - | - |
| Waterfall | CategoryAxisEx | ValueAxisEx | - |
The following example changes the font size for both ChartEx axes:
using DevExpress.Docs.Office;
using DevExpress.Docs.Presentation;
ChartEx chartEx = new ChartEx();
slide.Shapes.Add(chartEx);
chartEx.Width = presentation.SlideSize.Width;
chartEx.Height = presentation.SlideSize.Height;
WaterfallSeries series = new WaterfallSeries();
series.Text = "Cash Flow";
series.Arguments = new ChartStringData(new[] { "Start", "Jan", "Feb", "Mar", "End" });
series.Values = new ChartNumericData(new[] { 5.0, 12.0, -5.0, 8.0, 15.0 });
chartEx.Series.Add(series);
CategoryAxisEx? xAxis = chartEx.ArgumentAxis;
if (xAxis != null) {
xAxis.TextProperties = new TextProperties { FontSize = 24 };
}
ValueAxisEx? yAxis = chartEx.ValueAxis;
if (yAxis != null) {
yAxis.TextProperties = new TextProperties { FontSize = 24 };
}
Customize Axes
ChartEx axis customization is similar to Chart. For more information on how to customize axes and their elements, refer to the following help topic: Chart Axes.