One Logo Pool Ball
Charts · IOS API REFERENCE

DateBins

struct · iOS 16.0+ · SDK 27.1

struct DateBins

A collection of bins for a chart that plots data against dates.

Members (11)

get · iOS 16.0+

startIndex

TypeScript
get startIndex(): number
Swift declaration
var startIndex: Int { get }

The position of the first element in a nonempty collection. If the collection is empty, `startIndex` is equal to `endIndex`.

init · iOS 16.0+

init

TypeScript
static initThresholds(thresholds: Array<globalThis.Date>): DateBins
Swift declaration
nonisolated init(thresholds: [Date])

Creates N-1 bins with the given N `thresholds`. - Parameter thresholds: The threshold values that surround the bins. - Returns: The bins.

get · iOS 16.0+

thresholds

TypeScript
get thresholds(): Array<globalThis.Date>
Swift declaration
var thresholds: [Date] { get }

Find the bin thresholds. - Returns: The bin thresholds that surround the bins.

init · iOS 16.0+

init

TypeScript
static initTimeIntervalRange(timeInterval: number, range: SDKHandle): DateBins
Swift declaration
nonisolated init(timeInterval: TimeInterval, range: ClosedRange<Date>)

Creates uniform bins covering the given range. The first bin starts at the lower bound of the range. - Parameter timeInterval: The size of the bins. - Parameter range: The range of the data the bins cover. - Returns: The bins.

init · iOS 16.0+

init

TypeScript
static initDataDesiredCountCalendar(data: Array<globalThis.Date>, desiredCount?: (number) | null, calendar?: _Foundation_Calendar): DateBins
Swift declaration
nonisolated init(data: [Date], desiredCount: Int? = nil, calendar: Calendar = .autoupdatingCurrent)

Automatically determine the bins from data. - Parameter data: The given data values. - Parameter desiredCount: The desired number of bins for the given data. If `nil`, infer the number of bins automatically from data using [Scott's normal reference rule](https://doi.org/10.1093/biomet/66.3.605) capped at 200. - Returns: The inferred bins.

init · iOS 16.0+

init

TypeScript
static initUnitByRangeCalendar(unit: _Foundation_Calendar_Component, stride: number, range: SDKHandle, calendar?: _Foundation_Calendar): DateBins
Swift declaration
nonisolated init(unit: Calendar.Component, by stride: Int = 1, range: ClosedRange<Date>, calendar: Calendar = .autoupdatingCurrent)

Creates uniform bins covering the given range. - Parameter unit: The size of the bins. - Parameter stride: The number of components for each bin. - Parameter range: The range of the data the bins cover. - Parameter calendar: The calendar to use. - Returns: The bins.

method · iOS 16.0+

index

TypeScript
indexFor(value: globalThis.Date): number
Swift declaration
func index(for value: Date) -> Int

Returns the bin index for the given value. - Parameter value: The date value to get the index for. - Returns: The bin index.

method · iOS 16.0+

index

TypeScript
indexAfter(i: number): number
Swift declaration
func index(after i: Int) -> Int

Returns the position immediately after the given index. The successor of an index must be well defined. For an index `i` into a collection `c`, calling `c.index(after: i)` returns the same index every time. - Parameter i: A valid index of the collection. `i` must be less than `endIndex`. - Returns: The index value immediately after `i`.

init · iOS 16.0+

init

TypeScript
static initRangeDesiredCountCalendar(range: SDKHandle, desiredCount?: number, calendar?: _Foundation_Calendar): DateBins
Swift declaration
nonisolated init(range: ClosedRange<Date>, desiredCount: Int = 10, calendar: Calendar = .autoupdatingCurrent)

Automatically determine the bins from a range of data. - Parameter range: The range the bins should cover. - Parameter desiredCount: The desired number of bins for the given data. - Returns: The inferred bins.

get · iOS 16.0+

endIndex

TypeScript
get endIndex(): number
Swift declaration
var endIndex: Int { get }

The collection's "past the end" position---that is, the position one greater than the last valid subscript argument. When you need a range that includes the last element of a collection, use the half-open range operator (`..<`) with `endIndex`. The `..<` operator creates a range that doesn't include the upper bound, so it's always safe to use with `endIndex`. For example: let numbers = [10, 20, 30, 40, 50] if let index = numbers.firstIndex(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]" If the collection is empty, `endIndex` is equal to `startIndex`.

subscript · iOS 16.0+

subscript

TypeScript
subscript(position: number): ChartBinRange<globalThis.Date>
Swift declaration
subscript(position: Int) -> ChartBinRange<Date> { get }

Accesses the element at the specified position. The following example accesses an element of an array through its subscript to print its value: var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] print(streets[1]) // Prints "Bryant" You can subscript a collection with any valid index other than the collection's end index. The end index refers to the position one past the last element of a collection, so it doesn't correspond with an element. - Parameter position: The position of the element to access. `position` must be a valid index of the collection that is not equal to the `endIndex` property. - Complexity: O(1)

Skipped declarations

No declarations were skipped in this snapshot.

All Charts types →