Axes in WPF OLAP Chart

18 Nov 20185 minutes to read

An OLAP area contains two axes, the primary axis and secondary axis, in an OLAP chart control. Values or data in the chart are plotted against these axes.

Grid lines customization

In general, for column type charts, the horizontal grid lines belong to the secondary axis. To disable the horizontal grid lines for these types of charts, you should use the ShowGridLinesProperty of the secondary axis.

The following illustration describes how the chart will look after the horizontal grid lines are disabled.

To disable the horizontal grid lines

The following code sample describes how to disable the horizontal grid lines.

this.olapChart.Series[0].Area.SecondaryAxis.SetValue(ChartArea.ShowGridLinesProperty, false);
Me.olapChart.Series(0).Area.SecondaryAxis.SetValue(ChartArea.ShowGridLinesProperty, False)

For bar type charts, such as bar, stacking bar, and stacking 100 bar, you can disable the horizontal grid lines by using the ShowGridLinesProperty of the primary axis.

In general, for column type charts, the vertical grid lines belong to the primary axis. To disable the vertical grid lines for these types of charts, you should use the ShowGridLinesProperty of the primary axis.

The following illustration describes how the chart will look after the vertical grid lines are disabled.

To disable the vertical grid lines

The following code sample describes how to disable the vertical grid lines.

this.olapChart.Series[0].Area.PrimaryAxis.SetValue(ChartArea.ShowGridLinesProperty, false);
Me.olapChart.Series(0).Area.PrimaryAxis.SetValue(ChartArea.ShowGridLinesProperty, False)

For bar type charts such as bar, stacking bar, and stacking 100 bar, you can disable the vertical grid lines by using the ShowGridLinesProperty of the secondary axis.

Format settings

To display the ‘%’ symbol in the secondary axis, you should set the secondary axis label format property. The following code sample describes the usage of ‘%’ in the secondary axis label.

  • XAML
  • <syncfusion:OlapChart.SecondaryAxis>
         <syncfusion:ChartAxis LabelFormat="00.00%" />
    </syncfusion:OlapChart.SecondaryAxis>

    To display the percentage symbol in the secondary axis

    To display the currency symbol in the secondary axis, you should set the secondary axis label format property. The following code sample describes the usage of currency in the secondary axis label.

  • XAML
  • <syncfusion:OlapChart.SecondaryAxis>
         <syncfusion:ChartAxis LabelFormat="C" />
    </syncfusion:OlapChart.SecondaryAxis>

    To display the currency symbol in the secondary axis

    Label font settings

    The label font settings of the primary and secondary axes can be easily applied to an WPF OLAP Chart by specifying the label font properties, which are available under the primary and secondary axes of it.

    <syncfusion:OlapChart.PrimaryAxis>
    <syncfusion:ChartAxis LabelFormat="C"
          LabelFontFamily="Arial" 
          LabelFontSize="14" 
          LabelFontWeight="ExtraBold" 
          LabelForeground="DarkGray"  />
    </syncfusion:OlapChart.PrimaryAxis>
    <syncfusion:OlapChart.SecondaryAxis>
    <syncfusion:ChartAxis LabelFormat="C"
          LabelFontFamily="Arial" 
          LabelFontSize="14" 
          LabelFontWeight="ExtraBold" 
          LabelForeground="DarkGray"  />
    </syncfusion:OlapChart.SecondaryAxis>
    this.olapChart.PrimaryAxis.LabelForeground = Brushes.DarkGray;
    this.olapChart.PrimaryAxis.LabelFontFamily = new FontFamily("Arial");
    this.olapChart.PrimaryAxis.LabelFontSize = 14d;
    this.olapChart.PrimaryAxis.LabelFontWeight = FontWeights.ExtraBold;
    this.olapChart.SecondaryAxis.LabelForeground = Brushes.DarkGray;
    this.olapChart.SecondaryAxis.LabelFontFamily = new FontFamily("Arial");
    this.olapChart.SecondaryAxis.LabelFontSize = 14d;
    this.olapChart.SecondaryAxis.LabelFontWeight = FontWeights.ExtraBold;