How to display numeric axis labels with thousand separator in Blazor Charts?
This article explains how to display numeric axis labels with thousand separators.
Displaying numeric axis labels with thousand separators
Blazor Charts provides an option to render double axis labels with thousand separators using ChartPrimaryYAxis LabelFormat property.
When LabelFormat is specified as N0, then axis labels are displayed with commas as thousand separators.
The below code example demonstrates how to display numeric axis labels with thousand separators.
Index.razor
@using Syncfusion.Blazor.Charts
<SfChart>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
<ChartSeriesCollection>
<ChartSeries DataSource="@Data" XName="X" YName="Y" Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column">
</ChartSeries>
<ChartPrimaryYAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Double" LabelFormat="N0">
</ChartPrimaryYAxis>
</ChartSeriesCollection>
</SfChart>
@code{
public class ChartData
{
public string X { get; set; }
public double Y { get; set; }
}
public List<ChartData> Data = new List<ChartData>
{
new ChartData { X = "SD", Y = 1100000 },
new ChartData { X = "RS", Y = 1500000 },
new ChartData { X = "DF", Y = 5800000 },
new ChartData { X = "MG", Y = 2800000 },
new ChartData { X = "RN", Y = 1200000 },
new ChartData { X = "SP", Y = 9500000 },
new ChartData { X = "GO", Y = 6200000 },
new ChartData { X = "AM", Y = 1000000 },
};
}
The following screenshot illustrates the output of the code snippet.
Output
Conclusion
I hope you enjoyed learning how to display numeric axis labels with thousand separators in the 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!