init(x:y:)
Creates a point mark that plots a value on x with fixed y position.
Declaration
nonisolated init<X>(x: PlottableValue<X>, y: CGFloat? = nil) where X : PlottableParameters
- x:
The value plotted with x.
- y:
The y position. If
yisnil, the bar will be centered vertically by default.
Discussion
Use this initializer to plot a property with x:
Chart(data) {
PointMark(
x: .value("Weight", $0.weight)
)
}[Image]
For more background, see the first example used in PointMark which shows the structure that contains the weight property.