In This Article

Grid Lines and Stripes

Grid lines and stripes appear behind the chart data and allow the user to easily compare data against axis values.

Line Visibility

Visibility of the grid lines is controlled using XYChart.GridLineMajorVisibility and XYChart.GridLineMinorVisibility. These properties can be set to None, All, X, or Y.

Screenshot

This is an example of setting GridLineMajorVisibility to Y, in which grid lines are shown for each major tick on the Y axis.

<charts:XYChart GridLineVisibility="Y" .../>

Screenshot

This is an example of setting GridLineMajorVisibility to X, in which grid lines are shown for each major tick on the X axis.

<charts:XYChart GridLineVisibility="X" .../>

Screenshot

This is an example of setting GridLineMajorVisibility to All, in which grid lines are shown for each major tick on the X and Y axis.

<charts:XYChart GridLineVisibility="All" .../>

Stripe Visibility

Visibility of the grid stripes is controlled using XYChart.GridStripeVisibility. This property can be set to None, X, or Y.

Screenshot

This is an example of setting GridLineMajorVisibility to Y, in which grid stripes are shown alternating between each major tick on the Y axis.

<charts:XYChart GridLineVisibility="Y" .../>

Screenshot

This is an example of setting GridLineMajorVisibility to X, in which grid stripes are shown alternating between each major tick on the X axis.

<charts:XYChart GridLineVisibility="X" .../>

Line Customization

The color of major and minor grid lines can be controlled using XYChart.GridLineMajorBrush and XYChart.GridLineMinorBrush, respectively.

Screenshot

This is an example of setting GridLineMajorBrush and GridLineMinorBrush to custom colors.

<charts:XYChart .... GridLineMajorBrush="#338833" GridLineMinorBrush="#33bb33">

Stripe Customization

The color of grid stripes and alternating grid stripes can be controlled using XYChart.GridStripeBrush and XYChart.GridStripeAlternatingBrush.

Screenshot

This is an example of setting GridStripeBrush and GridStripeAlternatingBrush to custom colors.

<charts:XYChart .... GridStripeBrush="#55338833" GridStripeAlternatingBrush="#2233bb33">