init(x:y:series:)
Creates a separate line for each unique value of series.
Declaration
nonisolated init<X, Y, S>(x: PlottableValue<X>, y: PlottableValue<Y>, series: PlottableValue<S>) where X : Plottable, Y : Plottable, S : PlottableParameters
- x:
The value plotted with x.
- y:
The value plotted with y.
- series:
The value with which to split the line series by.
Discussion
Use this initializer to create a multi-line chart from a single data source.
Chart(sunshineData) {
LineMark(
x: .value("Month", $0.date),
y: .value("Hours of Sunshine", $0.hoursOfSunshine)
)
.foregroundStyle(by: .value("City", $0.city))
}[Image]