officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-series-b55f7bd3.md
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
int GapWidth { get; set; }
Property GapWidth As Integer
| Type | Description |
|---|---|
| Int32 |
The gap width, as a percentage. This value must be between 0 and 500.
|
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.
The example below demonstrates how to create a histogram chart and specify the distance between histogram bins.
// 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");
' 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