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

DxChartValueAxis.ZeroAlwaysVisible Property

Specifies whether the value axis should always display zero.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(null)]
[Parameter]
public bool? ZeroAlwaysVisible { get; set; }

#Property Value

Type Default Description
Nullable<Boolean> null

true to always show zero; otherwise, false.

#Remarks

The Chart’s DxChartValueAxis shows a zero value for area and bar series. For other series types, this behavior depends on the data source.

In the following code snippet, all series values are greater than 13, and the Chart uses 12 as the first value of the Y-axis.

The Line Series Does Not Show Zero (Default)

To display a zero regardless of the series type and values, set the ZeroAlwaysVisible property to true.

Razor
@using Chart.Data
@inject WeatherForecastService ForecastService

<DxChart Data="@ChartData">
    <DxChartLineSeries ArgumentField="@((WeatherForecast i) => i.Date)"
                       ValueField="@((WeatherForecast i) => i.TemperatureC)"
                       Name="Temperature" />
    <DxChartValueAxis ZeroAlwaysVisible="true" />
</DxChart>

@code {
    WeatherForecast[] ChartData;

    protected override async Task OnInitializedAsync()
    {
        ChartData = await ForecastService.GetForecastAsync();
    }
}

Zero Is Visible on the Value Axis

See Also