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

WaterfallSeries2D.SubtotalBarBrush Attached Property

Gets or sets the subtotal bar brush.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

#Declaration

#Returns

Type Description
SolidColorBrush

The subtotal bar fill brush.

#Example

This example shows how to create a waterfall chart.

Waterfall chart

Markup:

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WaterfallChart"
        xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" 
        x:Class="WaterfallChart.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="500" Width="800">
    <Grid>
        <dxc:ChartControl>
            <dxc:XYDiagram2D dxc:WaterfallSeries2D.TotalBarBrush="Gray"
                             dxc:WaterfallSeries2D.StartBarBrush="LightGray"
                             dxc:WaterfallSeries2D.SubtotalBarBrush="DarkGray"
                             dxc:WaterfallSeries2D.ConnectorBrush="Black">
                <dxc:WaterfallSeries2D.ValueOptions>
                    <dxc:WaterfallRelativeValueOptions StartBarValue="30" 
                                                       StartBarLabel="Start Value"
                                                       ShowTotal="True"
                                                       TotalLabel="Total">
                        <dxc:WaterfallRelativeValueOptions.Subtotals>
                            <dxc:Subtotal PointIndex="2" Label="Subtotal"/>
                        </dxc:WaterfallRelativeValueOptions.Subtotals>
                    </dxc:WaterfallRelativeValueOptions>
                </dxc:WaterfallSeries2D.ValueOptions>
                <dxc:WaterfallSeries2D DisplayName="Waterfall" 
                                       LabelsVisibility="True"
                                       DataSource="{Binding}"
                                       ArgumentScaleType="Qualitative"
                                       ArgumentDataMember="Argument"
                                       ValueDataMember="Value"
                                       RisingBarBrush="#FF92CEB5" 
                                       FallingBarBrush="#FFDA5859">
                    <dxc:WaterfallSeries2D.Model>
                        <dxc:BorderlessSimpleWaterfall2DModel/>
                    </dxc:WaterfallSeries2D.Model>
                </dxc:WaterfallSeries2D>
                <dxc:XYDiagram2D.AxisX>
                    <dxc:AxisX2D TickmarksMinorVisible="False"/>
                </dxc:XYDiagram2D.AxisX>
            </dxc:XYDiagram2D>
        </dxc:ChartControl>
    </Grid>
</Window>

Code-behind:

using System.Collections.Generic;
using System.Windows;

namespace WaterfallChart {
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
            this.DataContext = DataLoader.GetDataPoints();
        }
    }
    class DataLoader {
        public static List<DataPoint> GetDataPoints() {
            List<DataPoint> list = new List<DataPoint> {
                new DataPoint("November", 20),
                new DataPoint("December", 10),
                new DataPoint("January", -15),
                new DataPoint("February", 10),
                new DataPoint("March", -10)
            };
            return list;
        }
    }
    public class DataPoint {
        public string Argument { get; private set; }
        public double Value { get; private set; }
        public DataPoint(string arg, double val) {
            Argument = arg;
            Value = val;
        }
    }
}
See Also