Back to Devexpress

Series.GapWidth Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-series-b55f7bd3.md

latest2.9 KB
Original Source

Series.GapWidth Property

Returns or specifies the distance between data points on the chart.

Namespace : DevExpress.Spreadsheet.Charts

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
int GapWidth { get; set; }
vb
Property GapWidth As Integer

Property Value

TypeDescription
Int32

The gap width, as a percentage. This value must be between 0 and 500.

|

Remarks

Use the GapWidth property to specify the space between bars or columns on the chart as a percentage of the bar or column width. You can set this property for the following charts:

  • Bar;

  • Column;

  • Box and Whisker;

  • Waterfall;

  • Histogram;

  • Pareto;

  • Funnel.

For a Pie of Pie or Bar of Pie chart, the GapWidth property specifies the space between the primary and secondary chart sections.

Example

The example below demonstrates how to create a histogram chart and specify the distance between histogram bins.

csharp
// Create a histogram chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Histogram, worksheet["B2:B21"]);
chart.TopLeftCell = worksheet.Cells["D2"];
chart.BottomRightCell = worksheet.Cells["K18"];

// Specify histogram series options.
var options = chart.Series[0].LayoutOptions.Histogram;
options.BinType = HistogramBinType.BinWidth;
options.BinWidth = 24;
// Specify the gap width.
chart.Series[0].GapWidth = 10;

// Add the chart title.
chart.Title.Visible = true;
chart.Title.SetValue("Exam Score Distribution");
vb
' Create a histogram chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.Histogram, worksheet("B2:B21"))
chart.TopLeftCell = worksheet.Cells("D2")
chart.BottomRightCell = worksheet.Cells("K18")

' Specify histogram series options.
Dim options As HistogramSeriesOptions = chart.Series(0).LayoutOptions.Histogram
options.BinType = HistogramBinType.BinWidth
options.BinWidth = 24
' Specify the gap width.
chart.Series(0).GapWidth = 10

' Add the chart title.
chart.Title.Visible = True
chart.Title.SetValue("Exam Score Distribution")

See Also

Series Interface

Series Members

DevExpress.Spreadsheet.Charts Namespace