# ChartHistogramBinLayout

Defines one reusable histogram binning scheme so multiple series can share identical bounds.

 Class  

`ChartForgeX.Core`

**Namespace**

`ChartForgeX.Core`

**Assembly**

`ChartForgeX`

**Source**

[ChartHistogramBinLayout.cs:40](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L40)

**Modifiers**

sealed

Defines one reusable histogram binning scheme so multiple series can share identical bounds.

## Inheritance

- object
- ChartHistogramBinLayout

## Usage

 Explore 10 API references to this type 

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 7

- Property [ChartHistogramBin.Layout](/api/chartforgex-core-charthistogrambin/#property-layout)
- Method [ChartHistogramBinLayout.FromBoundaries](/api/chartforgex-core-charthistogrambinlayout/#method-fromboundaries-collections-generic-ienumerable-system-double)
- Method [ChartHistogramBinLayout.FromCount](/api/chartforgex-core-charthistogrambinlayout/#method-fromcount-double-double-int32)
- Method [ChartHistogramBinLayout.FromIntervals](/api/chartforgex-core-charthistogrambinlayout/#method-fromintervals-collections-generic-ienumerable-system-valuetuple-system-double-system-double)
- Method [ChartHistogramBinLayout.FromWidth](/api/chartforgex-core-charthistogrambinlayout/#method-fromwidth-double-double-double)
- Property [ChartSeries.HistogramBinLayout](/api/chartforgex-core-chartseries/#property-histogrambinlayout)
- Property [ChartDataBin<T>.Layout](/api/chartforgex-data-chartdatabin/#property-layout)

### Accepted by parameters 3

- Method [Chart.AddHistogram](/api/chartforgex-core-chart/#method-addhistogram-string-collections-generic-ienumerable-system-double-chartforgex-core-charthistogrambinlayout-nullable-chartforgex-primitives-chartcolor) parameter `layout`
- Method [ChartSeries.CreateHistogram](/api/chartforgex-core-chartseries/#method-createhistogram-chartforgex-core-chartseriesid-string-collections-generic-ienumerable-chartforgex-core-charthistogramobservation-chartforgex-core-charthistogrambinlayout-chartforgex-core-charthistogramaggregation-chartforgex-core-charthistogramencoding-nullable-chartforgex-primitives-chartcolor) parameter `layout`
- Method [ChartDataset<T>.Bin](/api/chartforgex-data-chartdataset/#method-bin-func-system-double-chartforgex-core-charthistogrambinlayout) parameter `layout`

 Filter members   

    Show inherited   

 

## Methods

 `public static ChartHistogramBinLayout FromBoundaries(IEnumerable<double> boundaries)` [#](#method-fromboundaries-collections-generic-ienumerable-system-double) 

[ChartHistogramBinLayout.Authored.cs:21](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.Authored.cs#L21)

Creates adjacent bins from strictly increasing finite boundaries, preserving their unequal widths.

Parameters

**boundaries System.Collections.Generic.IEnumerable<double> required**

At least two boundaries, in increasing order. Inputs are copied.

Returns

 `ChartHistogramBinLayout` An immutable reusable layout. Each bin is half open except the final inclusive upper bound. 

 FromCount 2 overloads 

 `public static ChartHistogramBinLayout FromCount(double minimum, double maximum, int binCount)` [#](#method-fromcount-double-double-int32) 

[ChartHistogramBinLayout.cs:40](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L40)

Creates the requested count of equal-width bins with boundaries aligned to a nice decimal step where possible.

Parameters

**minimum double required**

**maximum double required**

**binCount int required**

Returns

 `ChartHistogramBinLayout` 

 `public static ChartHistogramBinLayout FromCount(double minimum, double maximum, int binCount, bool roundBounds)` [#](#method-fromcount-double-double-int32-boolean) 

[ChartHistogramBinLayout.cs:49](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L49)

Creates bins with rounded, aligned bounds, or preserves exact data bounds when roundBounds is false.

Parameters

**minimum double required**

The lowest data value.

**maximum double required**

The highest data value.

**binCount int required**

The requested count; constant data uses one bin.

**roundBounds bool required**

Whether to align to multiples of a 1, 2, 2.5, 5 or 10 decimal step. A single bin crossing zero preserves the data bounds because no zero-aligned interval can cover both signs.

Returns

 `ChartHistogramBinLayout` A reusable bin layout. 

 `public static ChartHistogramBinLayout FromIntervals(IEnumerable<ValueTuple<double, double>> intervals)` [#](#method-fromintervals-collections-generic-ienumerable-system-valuetuple-system-double-system-double) 

[ChartHistogramBinLayout.Authored.cs:31](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.Authored.cs#L31)

Creates finite, ordered, nonoverlapping bins with optional gaps between intervals.

Parameters

**intervals System.Collections.Generic.IEnumerable<System.ValueTuple<double, double>> required**

Positive-width intervals in increasing order. Inputs are copied; values in gaps are rejected.

Returns

 `ChartHistogramBinLayout` An immutable reusable layout. Each interval is half open except the final inclusive upper bound. 

 FromWidth 2 overloads 

 `public static ChartHistogramBinLayout FromWidth(double minimum, double maximum, double binWidth)` [#](#method-fromwidth-double-double-double) 

[ChartHistogramBinLayout.cs:78](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L78)

Preserves the requested width and aligns all boundaries to its multiples, extending the domain to cover the data.

Parameters

**minimum double required**

**maximum double required**

**binWidth double required**

Returns

 `ChartHistogramBinLayout` 

 `public static ChartHistogramBinLayout FromWidth(double minimum, double maximum, double binWidth, bool roundBounds)` [#](#method-fromwidth-double-double-double-boolean) 

[ChartHistogramBinLayout.cs:87](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L87)

Preserves the width, using aligned equal-width bins or exact bounds with a possible final remainder bin.

Parameters

**minimum double required**

The lowest data value.

**maximum double required**

The highest data value.

**binWidth double required**

The caller's positive bin width.

**roundBounds bool required**

Whether to align bounds to multiples of the width.

Returns

 `ChartHistogramBinLayout` A reusable bin layout. 

 `public double GetCenter(int index)` [#](#method-getcenter-int32) 

[ChartHistogramBinLayout.cs:122](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L122)

Gets the midpoint used for the bin's chart coordinate.

Parameters

**index int required**

Returns

 `double` 

 `public double GetLowerBound(int index)` [#](#method-getlowerbound-int32) 

[ChartHistogramBinLayout.cs:110](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L110)

Gets the inclusive lower bound for a bin.

Parameters

**index int required**

Returns

 `double` 

 `public double GetUpperBound(int index)` [#](#method-getupperbound-int32) 

[ChartHistogramBinLayout.cs:116](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L116)

Gets the upper bound for a bin. The final bin includes this value.

Parameters

**index int required**

Returns

 `double` 

 `public double GetWidth(int index)` [#](#method-getwidth-int32) 

[ChartHistogramBinLayout.cs:127](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L127)

Gets the actual width of a bin, including a shorter final bin or an authored unequal interval.

Parameters

**index int required**

Returns

 `double` 

## Inherited Methods

 `public virtual bool Equals(object? obj)` [#](#method-equals-object) 

Inherited from object

Parameters

**obj object? required**

Returns

 `bool` 

 `public virtual int GetHashCode()` [#](#method-gethashcode) 

Inherited from object

Returns

 `int` 

 `public Type GetType()` [#](#method-gettype) 

Inherited from object

Returns

 `Type` 

 `public virtual string? ToString()` [#](#method-tostring) 

Inherited from object

Returns

 `string?` 

## Properties

 `public double Minimum { get; }` [#](#property-minimum) 

[ChartHistogramBinLayout.cs:31](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L31)

Gets the inclusive minimum covered by the layout.

 `public double Maximum { get; }` [#](#property-maximum) 

[ChartHistogramBinLayout.cs:34](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L34)

Gets the inclusive maximum covered by the layout.

 `public int Count { get; }` [#](#property-count) 

[ChartHistogramBinLayout.cs:37](https://github.com/EvotecIT/ChartForgeX/blob/main/ChartForgeX/Core/ChartHistogramBinLayout.cs#L37)

Gets the number of bins.

<!-- PowerForge markdown artifact sha256:3DE3D30C0A92D7272C5D96999C96677536B3137F38DE3F509CF9BB2BAE55184A -->
