Articles in this section
Category / Section

How to customize the style of minor gridlines in a Blazor Chart?

5 mins read

This article explains how to customize the minor gridline in Blazor Chart Component.

Customizing minor gridline style in Blazor Chart

Blazor Chart provides support to customize the minor gridlines. The width, color, and dash array of the minor gridlines can be customized by using MinorGridLines properties in the axis.

The following code example illustrates how to customize the minor gridlines.

Index.razor


@using Syncfusion.Blazor.Charts

<SfChart Title="Olympic Medals">

    <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category">        
    </ChartPrimaryXAxis>

    <ChartPrimaryYAxis MinorTicksPerInterval="2">
        <ChartAxisMinorGridLines Width="2" Color="blue" DashArray="5,3"/>
    </ChartPrimaryYAxis>

    <ChartSeriesCollection>
        <ChartSeries DataSource="@MedalDetails" XName="X" YName="Y" Fill="yellow"  Width="3" Type="ChartSeriesType.Spline">
        </ChartSeries>
    </ChartSeriesCollection>

</SfChart>

@code {

    public class ChartData
    {
        public string X { get; set; }
        public double Y { get; set; }
    }

    public List<ChartData> MedalDetails = new List<ChartData>
    {
        new ChartData { X= "South Korea", Y= 39.4 },
        new ChartData { X= "India", Y= 61.3 },
        new ChartData { X= "Pakistan", Y= 20.4 },
        new ChartData { X= "Germany", Y= 65.1 },
        new ChartData { X= "Australia", Y= 15.8 },
        new ChartData { X= "Italy", Y= 29.2 },
        new ChartData { X= "United Kingdom", Y= 44.6 },
        new ChartData { X= "Saudi Arabia", Y= 9.7 },
        new ChartData { X= "Russia", Y= 40.8 },
        new ChartData { X= "Mexico", Y= 31 },
        new ChartData { X= "Brazil", Y= 75.9 },
        new ChartData { X= "China", Y= 51.4 }
    };
}

The following screenshot illustrates the output of the above code snippet.
Output:

minor_gridline_customization.png

View the sample in GitHub

Conclusion

I hope you enjoyed learning how to customize minor gridline style in Blazor Chart Component.

You can refer to our Blazor Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Blazor Chart example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!

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