Skip to main content
All docs
V24.1

DxChart<T>.NegativesAsZeroes Property

Specifies whether the chart treats negative values as zeroes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[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