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

# init(range:desiredCount:calendar:)

Automatically determine the bins from a range of data.

## Declaration

```swift
nonisolated init(range: ClosedRange<Date>, desiredCount: Int = 10, calendar: Calendar = .autoupdatingCurrent)
```

## Parameters

- `range`: The range the bins should cover.
- `desiredCount`: The desired number of bins for the given data.

## Return Value

Return Value The inferred bins.
