Contents

BarPlot

Chart content that represents a collection of data using bars.

Declaration

struct BarPlot<Content>

Overview

Use BarPlot when you want to visualize data in the same way as with BarMark, but you want to visualize an entire data collection with a single plot.

You can initialize and style the plot with simple values or key paths. Add modifiers with KeyPath before adding modifiers with simple values.

BarPlot(
    votes,
    x: .value("Party", \.party),
    y: .value("Vote count", \.voteCount)
)
.foregroundStyle(by: \.partyShapeStyle)
.cornerRadius(4)

Topics

Plotting bars from a collection

Supporting types

See Also

Vectorized plots