Swift package · v0.1.0
KLCharts
Render grouped bar data with Swift Charts or Canvas.
Flat and dimensional SwiftUI bar charts with application-owned selection, formatting, colors, and navigation. Geometry and hit-testing helpers are available for tests.
Functions
- Flat and projected dimensional renderers
- Selection, clear, viewpoint reset, and formatting callbacks
- Dense-group horizontal expansion
- Testable width and hit-radius helpers
Not included
It renders resolved data; it does not aggregate domain models, localize labels, select themes, store UI state, or navigate from a bar.
Install with SwiftPM
Package.swiftSwift
.package(url: "https://github.com/KoenLee1023/KLCharts.git", from: "0.1.0")Usage
Integration exampleSwift
KLDimensionalBarChart(
data: data,
mode: mode,
emptyText: "No data",
selectedID: selectedID,
onSelect: { selectedID = $0.id }
)
.frame(height: 300)API documentation
Open the complete API documentation.KLDimensionalBarChartKeeps both renderers mounted and switches mode through opacity and hit testing.
KLDimensionalBarDatumSeparates stable group and series identity from resolved display values.
KLFlatBarChartLayoutPredicts horizontal canvas width without rendering a view.
Demo apps
Geometry Gallery
Switch one dataset between modes while preserving its frame.
Interaction Lab
Inspect selection, clearing, scrolling, viewpoint, and reset behavior.