Back to Devexpress

SubtotalDataPointCollection Interface

officefileapi-devexpress-dot-spreadsheet-dot-charts-9675739c.md

latest3.5 KB
Original Source

SubtotalDataPointCollection Interface

A collection of data points that are displayed as totals in a waterfall chart.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public interface SubtotalDataPointCollection :
    ISimpleCollection<int>,
    IEnumerable<int>,
    IEnumerable,
    ICollection
vb
Public Interface SubtotalDataPointCollection
    Inherits ISimpleCollection(Of Integer),
             IEnumerable(Of Integer),
             IEnumerable,
             ICollection

The following members return SubtotalDataPointCollection objects:

Remarks

If the source data for a waterfall chart includes subtotal and total values, you can display these values as total columns. These columns start on the horizontal axis at zero and do not float. Use the Series.LayoutOptions.Waterfall.SubtotalDataPoints.Add method to add the required data points to the total point collection.

The example below creates a waterfall chart. The third and last data points are displayed as totals.

csharp
// Create a waterfall chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Waterfall, worksheet["B2:C7"]);
chart.TopLeftCell = worksheet.Cells["E2"];
chart.BottomRightCell = worksheet.Cells["L17"];

// Hide the major gridlines for the value axis.
chart.PrimaryAxes[1].MajorGridlines.Visible = false;

// Specify series options.
var options = chart.Series[0].LayoutOptions.Waterfall;
// Display connector lines.
options.ShowConnectorLines = true;
// Set the third data point as the total.
options.SubtotalDataPoints.Add(2);
// Set the last data point as the total.
options.SubtotalDataPoints.Add(5);

// Add the chart title.
chart.Title.Visible = true;
chart.Title.SetValue("Income Statement");
vb
' Create a waterfall chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.Waterfall, worksheet("B2:C7"))
chart.TopLeftCell = worksheet.Cells("E2")
chart.BottomRightCell = worksheet.Cells("L17")

' Hide the major gridlines for the value axis.
chart.PrimaryAxes(1).MajorGridlines.Visible = False

' Specify series options.
Dim options As WaterfallSeriesOptions = chart.Series(0).LayoutOptions.Waterfall
' Display connector lines.
options.ShowConnectorLines = True
' Set the third data point as the total.
options.SubtotalDataPoints.Add(2)
' Set the last data point as the total.
options.SubtotalDataPoints.Add(5)

' Add the chart title.
chart.Title.Visible = True
chart.Title.SetValue("Income Statement")

See Also

SubtotalDataPointCollection Members

DevExpress.Spreadsheet.Charts Namespace