Back to Devexpress

WaterfallAbsoluteValueOptions Class

corelibraries-devexpress-dot-xtracharts-dffe7f5a.md

latest6.0 KB
Original Source

WaterfallAbsoluteValueOptions Class

Stores settings for a waterfall chart that displays absolute data values.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public class WaterfallAbsoluteValueOptions :
    WaterfallValueOptionsBase
vb
Public Class WaterfallAbsoluteValueOptions
    Inherits WaterfallValueOptionsBase

Remarks

Use the WaterfallAbsoluteValueOptions when the chart data source stores absolute values. In this case, the chart control automatically calculates differences between neighbor data point values and displays them as rising and falling bars.

Example

This example shows how to create a waterfall chart based on a set of absolute data values.

csharp
using DevExpress.XtraCharts;
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;

namespace WaterfallChart {
    public partial class Form1 : XtraForm {
        public Form1() {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e) {
            Series series = new Series("Series", ViewType.Waterfall);
            series.DataSource = DataPoint.GetDataPoints();
            series.ArgumentDataMember = "Argument";
            series.ValueDataMembers.AddRange(new string[] { "Value" });
            series.ArgumentScaleType = ScaleType.Qualitative;
            chartControl1.Series.Add(series);
            series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
            WaterfallSeriesView view = series.View as WaterfallSeriesView;
            if (view != null) {
                view.ValueOptions = new WaterfallAbsoluteValueOptions { ShowTotal = true };
            }
        }
    }
    public class DataPoint {
        public string Argument { get; set; }
        public double Value { get; set; }
        public DataPoint(string argument, double value) {
            this.Argument = argument;
            this.Value = value;
        }
        public static List<DataPoint> GetDataPoints() {
            List<DataPoint> data = new List<DataPoint> {
                new DataPoint("November", 10),
                new DataPoint("December", 15),
                new DataPoint("January", -10),
                new DataPoint("February", -5),
                new DataPoint("March", -20)
            };
            return data;
        }
    }
}
vb
Imports DevExpress.XtraCharts
Imports DevExpress.XtraEditors
Imports System
Imports System.Collections.Generic

Namespace WaterfallChart
    Public Partial Class Form1
        Inherits XtraForm

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
            Dim series As Series = New Series("Series", ViewType.Waterfall)
            series.DataSource = DataPoint.GetDataPoints()
            series.ArgumentDataMember = "Argument"
            series.ValueDataMembers.AddRange(New String() {"Value"})
            series.ArgumentScaleType = ScaleType.Qualitative
            chartControl1.Series.Add(series)
            series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.[True]
            Dim view As WaterfallSeriesView = TryCast(series.View, WaterfallSeriesView)
            If view IsNot Nothing Then
                view.ValueOptions = New WaterfallAbsoluteValueOptions With { .ShowTotal = True }
            End If
        End Sub
    End Class

    Public Class DataPoint
        Public Property Argument As String
        Public Property Value As Double

        Public Sub New(ByVal argument As String, ByVal value As Double)
            Me.Argument = argument
            Me.Value = value
        End Sub

        Public Shared Function GetDataPoints() As List(Of DataPoint)
            Dim data As List(Of DataPoint) = New List(Of DataPoint) From {
                New DataPoint("November", 10),
                New DataPoint("December", 15),
                New DataPoint("January", -10),
                New DataPoint("February", -5),
                New DataPoint("March", -20)
            }
            Return data
        End Function
    End Class
End Namespace

Implements

IXtraSupportDeserializeCollectionItem

Inheritance

Object ChartElement WaterfallValueOptionsBase WaterfallAbsoluteValueOptions

See Also

WaterfallAbsoluteValueOptions Members

DevExpress.XtraCharts Namespace