Articles in this section
Category / Section

How to rotate the data labels in Blazor Chart?

3 mins read

This article explains how to rotate the data labels in Blazor Chart Component.

Rotating data labels in Blazor Chart

Blazor Chart provides the support to rotate data label. Data label can be rotated by setting the EnableRotation property to true and by setting the angle(in degrees) to the Angle property of ChartDataLabel.

The following code example illustrates this.

Index.razor


@using Syncfusion.Blazor.Charts

<SfChart>

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

    <ChartSeriesCollection>
        <ChartSeries DataSource="@WeatherReports" XName="X" YName="Y" Type="ChartSeriesType.Column">
            <ChartMarker>               
                <ChartDataLabel Visible="true" EnableRotation="true" Position="Syncfusion.Blazor.Charts.LabelPosition.Middle" Angle="45">
                    <ChartDataLabelFont Size="20" ></ChartDataLabelFont>                    
                </ChartDataLabel>                
            </ChartMarker>
        </ChartSeries>
    </ChartSeriesCollection>

</SfChart>

@code {

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

    public List<Data> WeatherReports = new List<Data>
    {
        new Data{ X= "Jan", Y= 3 },
        new Data{ X= "Feb", Y= 3.5 },
        new Data{ X= "Mar", Y= 7 },
        new Data{ X= "Apr", Y= 13.5 }
    };     
}

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

Output:

datalabel-rotation.png

View the sample in GitHub

Conclusion

I hope you enjoyed learning how to rotate data label of 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