officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-subtotaldatapointcollection-dot-add-x28-system-dot-int32-x29.md
Adds a data point to the collection of ‘total’ points.
Namespace : DevExpress.Spreadsheet.Charts
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
int Add(
int item
)
Function Add(
item As Integer
) As Integer
| Name | Type | Description |
|---|---|---|
| item | Int32 |
The zero-based position of the data point within the series.
|
| Type | Description |
|---|---|
| Int32 |
A zero-based index of the ‘total’ point within the collection.
|
The example below creates a waterfall chart. The third and last data points are displayed as totals.
// 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");
' 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 Interface