init(x:y:z:)
Creates a horizontal or vertical rule mark for a 3D chart.
Declaration
nonisolated init(x: PlottableValue<some Plottable>, y: PlottableValue<some Plottable>, z: PlottableValue<some Plottable>)Parameters
- x:
The x value.
- y:
The y value.
- z:
The z value.
Discussion
Use this initializer to create rules at positions along two axes, and a range along a third axis:
Chart3D {
// A red rule from from -0.5 to 0.5 on the x-axis, positioned at y = 0, z = 0
RuleMark(
x: .value("x", -0.5..<0.5),
y: .value("y", 0),
z: .value("z", 0)
)
.foregroundStyle(.red)
// A green rule from -0.5 to 0.5 on the y-axis, positioned at x = 0, z = 0
RuleMark(
x: .value("x", 0),
y: .value("y", -0.5..<0.5),
z: .value("z", 0)
)
.foregroundStyle(.green)
// A blue rule from from -0.5 to 0.5 on the z-axis, positioned at x = 0, y = 0
RuleMark(
x: .value("x", 0),
y: .value("y", 0),
z: .value("z", -0.5..<0.5)
)
.foregroundStyle(.blue)
}