Skip to main content
All docs
V24.1

Series.GapWidth Property

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

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

int GapWidth { get; set; }

Property Value

Type Description
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.

Histogram chart

// 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");
See Also