Articles in this section
Category / Section

How to customize the minor gridline style

1 min read

Essential chart for Xamarin.Forms provides support to customize the minor gridlines. The ShowMinorGridLines property is used to control the visibility of minor gridlines, and the MinorGridLineStyle property is used to customize the minor gridlines style. It provides options to customize the width, dashes, and color.

The following code illustrates how to customize the minor gridlines.

XAML

<chart:SfChart.SecondaryAxis>
      <chart:NumericalAxis ShowMinorGridLines="True" MinorTicksPerInterval="3">
        <chart:NumericalAxis.MinorGridLineStyle>
          <chart:ChartGridLineStyle  StrokeWidth="2" StrokeColor="Blue" />
        </chart:NumericalAxis.MinorGridLineStyle>
      </chart:NumericalAxis>
</chart:SfChart.SecondaryAxis> 

C#

NumericalAxis numAxis = new NumericalAxis();
numAxis.MinorTicksPerInterval = 3;
numAxis.ShowMinorGridLines = true;
numAxis.MinorGridLineStyle.StrokeWidth = 2;
numAxis.MinorGridLineStyle.StrokeDashArray = new double[2]{5,3};
numAxis.MinorGridLineStyle.StrokeColor = Color.Blue;
chart.SecondaryAxis = numAxis; 

Output:

Chart with customized gridlines in Xamarin.Forms

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied