How to display numeric axis labels with thousand separator in Blazor Charts?
This article explains how to display numeric axis labels with thousand separators in Blazor Charts.
Displaying Numeric Axis Labels with Thousand Separators:
Blazor Charts provides an option to render numeric axis labels with thousand separators using the ChartPrimaryYAxis LabelFormat property.
When LabelFormat is specified as N0, axis labels are displayed with commas as thousand separators.
The code example below 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:
Live Sample for Thousand Separators
Conclusion:
We 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 learn about its other groundbreaking features, documentation, and how to quickly get started with configuration specifications. You can also explore our Blazor Chart example to understand how to create and manipulate data.
For current customers, our Blazor components are available on the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to evaluate our Blazor Charts and other Blazor components.
If you have any questions 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!