Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ChartElementFormat.Percent(Nullable<Byte>) Method

Displays numbers as percentages.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public static ChartElementFormat Percent(
    byte? precision = null
)

#Optional Parameters

Name Type Default Description
precision Nullable<Byte> null

Specifies the number of digits in the fractional part of a value.

#Returns

Type Description
ChartElementFormat

A ChartElementFormat enumeration value.

#Remarks

The Percent method displays numbers as percentages, for example, 0.1 → 10%. You can use this method for axis and series labels. The following code snippet calls the method for the value axis of the Chart:

Razor
<DxChart Data="@forecasts">
    <DxChartValueAxis>
        <DxChartAxisLabel Format="ChartElementFormat.Percent()"></DxChartAxisLabel>
    </DxChartValueAxis>
    @* ... *@
</DxChart>

Formatted Y axis

You can also use the precision parameter to specify the number of digits in the fractional part of a value. For example, if precision equals 2, the value has the following formatting: 0.2 → 20.00%. This parameter is optional.

See Also