Skip to main content
All docs
V25.1
  • HistogramSeriesOptions.BinWidth Property

    Returns or specifies the bin width.

    Namespace: DevExpress.Spreadsheet.Charts

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

    NuGet Package: DevExpress.Spreadsheet.Core

    Declaration

    double BinWidth { get; set; }

    Property Value

    Type Description
    Double

    The bin width.

    Property Paths

    You can access this nested property as listed below:

    Object Type Path to BinWidth
    SeriesLayoutOptions
    .Histogram .BinWidth

    Remarks

    Set the HistogramSeriesOptions.BinType option to HistogramBinType.BinWidth and use the BinWidth property to define the custom width for histogram bins.

    The following example demonstrates how to create a histogram and specify the bin size.

    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