menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ChartAxisMajorGridLines - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ChartAxisMajorGridLines

    Represents the major grid lines for a chart axis, allowing the customization of their color, width, and dash patterns.

    Inheritance
    System.Object
    ChartSubComponent
    ChartAxisMajorGridLines
    Namespace: Syncfusion.Blazor.Charts
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ChartAxisMajorGridLines : ChartSubComponent, ISubcomponentTracker

    Constructors

    ChartAxisMajorGridLines()

    Declaration
    public ChartAxisMajorGridLines()

    Properties

    Color

    Gets or sets the color of the major grid line.

    Declaration
    public string Color { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the color of the major grid line. The default major grid line color is determined by the chart's theme. By default, the theme is set to Material with a major grid line color of #dbdbdb.

    Remarks

    Use valid hex or rgba CSS color strings for the color value.

    Examples
    // The following code demonstrates setting a custom color for the axis major gridlines.
    <SfChart>
        <ChartPrimaryXAxis>
            <ChartAxisMajorGridLines Color="red"  />
        </ChartPrimaryXAxis>
        <ChartPrimaryYAxis>
            <ChartAxisMajorGridLines Color="blue"  />
        </ChartPrimaryYAxis>
    </SfChart>

    DashArray

    Gets or sets the dash array of the major grid line.

    Declaration
    public string DashArray { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the dash array of the major grid line. The default value is an empty string.

    Remarks

    The dash array is used to create dashed lines, specified by a series of numbers that define the lengths of the dashes and gaps.

    Examples
    // The following code demonstrates setting a custom dash array for the axis major gridlines.
    <SfChart>
        <ChartPrimaryXAxis>
            <ChartAxisMajorGridLines DashArray="5,1" />
        </ChartPrimaryXAxis>
        <ChartPrimaryYAxis>
            <ChartAxisMajorGridLines DashArray="5,1" />
        </ChartPrimaryYAxis>
    </SfChart>

    Width

    Gets or sets the width of the major grid line in pixels.

    Declaration
    public double Width { get; set; }
    Property Value
    Type Description
    System.Double

    The double value representing the width of the major grid line in pixels. The default value is 1.

    Remarks

    The width determines the thickness of the grid line on the chart.

    Examples
    // The following code demonstrates setting a width thickness for the axis major gridlines.
    <SfChart>
        <ChartPrimaryXAxis>
            <ChartAxisMajorGridLines Width="3" />
        </ChartPrimaryXAxis>
        <ChartPrimaryYAxis>
            <ChartAxisMajorGridLines Width="3" />
        </ChartPrimaryYAxis>
    </SfChart>
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved