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