---
title: "init(unit:by:range:calendar:)"
framework: charts
role: symbol
role_heading: Initializer
path: "charts/datebins/init(unit:by:range:calendar:)"
---

# init(unit:by:range:calendar:)

Creates uniform bins covering the given range.

## Declaration

```swift
nonisolated init(unit: Calendar.Component, by stride: Int = 1, range: ClosedRange<Date>, calendar: Calendar = .autoupdatingCurrent)
```

## Parameters

- `unit`: The size of the bins.
- `stride`: The number of components for each bin.
- `range`: The range of the data the bins cover.
- `calendar`: The calendar to use.

## Return Value

Return Value The bins.
