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
init(_:x:y:width:height:stacking:)init(_:x:yStart:yEnd:width:)init(_:x:yStart:yEnd:width:stacking:)init(_:x:yStart:yEnd:width:stacking:)init(_:xStart:xEnd:y:height:stacking:)init(_:xStart:xEnd:y:height:stacking:)init(_:xStart:xEnd:y:height:)init(_:xStart:xEnd:yStart:yEnd:)init(_:xStart:xEnd:yStart:yEnd:)init(_:xStart:xEnd:yStart:yEnd:)init(_:xStart:xEnd:yStart:yEnd:)