Skip to content

NumberBins<T>

StructChartGuruChartGuru
public readonly struct NumberBins<T> where T : struct, IConvertible

Numeric bin specification. Swift Charts equivalent: NumberBins. Use ChartGuru.NumberBins%601.ByCount(System.Int32) for fixed bin counts, ChartGuru.NumberBins%601.ByThresholds(System.Collections.Generic.IEnumerable%7bSystem.Double%7d) for caller-supplied edges, or ChartGuru.NumberBins%601.ByDesiredSize(System.Double%2cSystem.Boolean) for a target bin width.

public readonly NumberBins<T>.Kind Mode

Returns

ChartGuru.NumberBins`1.Kind

public readonly int Count

Returns

System.Int32

public readonly double DesiredSize

Returns

System.Double

public readonly double[] Thresholds

Returns

System.Double[]

public readonly bool MinimumStride

Returns

System.Boolean

public readonly double RangeMin

Returns

System.Double

public readonly double RangeMax

Returns

System.Double

public readonly bool HasExplicitRange

Returns

System.Boolean

public static readonly NumberBins<T> Automatic

Returns

ChartGuru.NumberBins`1

public static NumberBins<T> ByCount(int count)

Requests an evenly distributed number of numeric bins, clamping the count to at least one.

Parameters

Name Type
count System.Int32

Returns

ChartGuru.NumberBins`1

public static NumberBins<T> ByThresholds(IEnumerable<double> thresholds)

Creates bins separated by a sorted copy of the supplied numeric thresholds. A null sequence produces one bin.

Parameters

Name Type
thresholds System.Collections.Generic.IEnumerable{System.Double}

Returns

ChartGuru.NumberBins`1

public static NumberBins<T> ByDesiredSize(double size, bool minimumStride = false)

Requests bins near the specified numeric width, optionally treating that width as a minimum stride.

Parameters

Name Type
size System.Double
minimumStride System.Boolean

Returns

ChartGuru.NumberBins`1

public double[] ComputeEdges(double rawMin, double rawMax)

Compute concrete bin edges for the supplied raw range. Returns sorted edges of length BinCount + 1.

Parameters

Name Type
rawMin System.Double
rawMax System.Double

Returns

System.Double[]

public NumberBins(IEnumerable<double> thresholds)

Swift parity: NumberBins(thresholds:).

Parameters

Name Type
thresholds System.Collections.Generic.IEnumerable{System.Double}
public NumberBins(int desiredCount)

Swift parity: NumberBins(desiredCount:) (data-driven, count-based).

Parameters

Name Type
desiredCount System.Int32
public NumberBins(double size, bool minimumStride = false)

Swift parity: NumberBins(size:) (data-driven, size-based).

Parameters

Name Type
size System.Double
minimumStride System.Boolean
public NumberBins(ClosedRange<double> range, double size, bool minimumStride = false)

Swift parity: NumberBins(range:size:). Produces fixed bins of size that span the supplied range, ignoring the dataset extents.

Parameters

Name Type
range ChartGuru.ClosedRange{System.Double}
size System.Double
minimumStride System.Boolean
public NumberBins(ClosedRange<double> range, int desiredCount)

Swift parity: NumberBins(range:desiredCount:). Uses desiredCount equally spaced bins across the supplied range.

Parameters

Name Type
range ChartGuru.ClosedRange{System.Double}
desiredCount System.Int32