Skip to main content

ChartView.GapWidth Property

Gets or sets the space between bar or column clusters in the Bar or Column charts, or the space between the primary and secondary charts in the Pie of Pie or Bar of Pie charts.

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

An integer value that is the percentage of the gap width. This value must be between 0 and 500.

Remarks

Use the GapWidth property to control the space between each bar or column in the Bar or Column chart with one series, or the space between each group of bars or columns if the chart has multiple series.

Utilizing this property for the Pie of Pie or Bar of Pie chart changes the space between the primary and secondary charts.

The following images demonstrate how the GapWidth property works (the charts are shown in Microsoft® Excel®)

GapWidth = 20 GapWidth = 200
ColumnChartGapWidth20 ColumnChartGapWidth200.png
PieOfPieChartGapWidth20 PieOfPieChartGapWidth200

Example

The example below demonstrates how to create the clustered column chart and specify the space between each column using the ChartView.GapWidth property.

View Example

Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];

// Set the gap width between data series.
chart.Views[0].GapWidth = 33;
// Hide the legend.
chart.Legend.Visible = false;

The following code snippets (auto-collected from DevExpress Examples) contain references to the GapWidth property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also