Back to Devexpress

HistogramSeriesOptions.BinCount Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-histogramseriesoptions-618a621c.md

latest3.1 KB
Original Source

HistogramSeriesOptions.BinCount Property

Returns or specifies the number of bins in a histogram chart.

Namespace : DevExpress.Spreadsheet.Charts

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

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

Property Value

TypeDescription
Int32

The number of histogram bins.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to BinCount
SeriesLayoutOptions

.Histogram .BinCount

|

Remarks

Set the HistogramSeriesOptions.BinType option to HistogramBinType.BinCount and use the BinCount property to specify the number of bins in a histogram chart.

The example below creates a histogram with four 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.BinCount;
// Specify the number of bins.
options.BinCount = 4;
// 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.BinCount
' Specify the number of bins.
options.BinCount = 4
' 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

HistogramSeriesOptions Interface

HistogramSeriesOptions Members

DevExpress.Spreadsheet.Charts Namespace