Skip to main content
All docs
V24.2

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

DxChart<T>.NegativesAsZeroes Property

Specifies whether the chart treats negative values as zeroes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[DefaultValue(false)]
[Parameter]
public bool NegativesAsZeroes { get; set; }

#Property Value

Type Default Description
Boolean false

true to display negative values as zeroes; otherwise, false.

#Remarks

The DxChart component allows you to create series with negative values. When you use stacked series, the chart displays negative values as follows:

DxChartStackedArea - Negative values

Set the NegativeAsZeroes property to true to display negative values as zeroes. Note that this property values apply to stacked series only.

@using ChartPane.Data
<DxChart Data="@ProfitData"
         NegativesAsZeroes="true">
    <DxChartTitle Text="Profit amount, $" />
    <DxChartStackedAreaSeries Name="2021"
                              T="Profit"
                              TArgument="String"
                              TValue="int"
                              Filter="@((Profit p) => p.Year == 2021)"
                              ArgumentField="p => p.Month"
                              ValueField="p => p.Amount">
        <DxChartSeriesPoint Visible="true" />
        <DxChartSeriesLabel Visible="true" />
    </DxChartStackedAreaSeries>
    <DxChartStackedAreaSeries Name="2022"
                              T="Profit"
                              TArgument="String"
                              TValue="int"
                              Filter="@((Profit p) => p.Year == 2022)"
                              ArgumentField="p => p.Month"
                              ValueField="p => p.Amount">
        <DxChartSeriesPoint Visible="true" />
        <DxChartSeriesLabel Visible="true" />
    </DxChartStackedAreaSeries>
</DxChart>

@code {
    IEnumerable<Profit> ProfitData;

    protected override void OnInitialized() {
        ProfitData = Profit.CreateDataSource();
    }
}

DxChartStackedArea - NegativeAsZeroes

See Also