init(_:id:content:)
Creates a chart composed of a series of marks.
Declaration
nonisolated init<Data, ID, C>(_ data: Data, id: KeyPath<Data.Element, ID>, @ChartContentBuilder content: @escaping (Data.Element) -> C) where Content == ForEach<Data, ID, C>, Data : RandomAccessCollection, ID : Hashable, C : ChartContentParameters
- data:
A collection of data.
- id:
A key path that represents a property of each data element that can act as a unique identifier for that element. Ensure that this property conforms to the Hashable protocol.
- content:
The mark that the chart should draw for each element in the data collection.
Discussion
This initializer wraps the data that you provide as input in an implicit ForEach structure. If you need to represent more than one series in your chart, use init(content:) instead.