Skip to content

Commit a84f885

Browse files
committed
Update 2.0.0 docs, migration, and usage guide
1 parent 2a15724 commit a84f885

4 files changed

Lines changed: 90 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## 2.0.0-beta.9
3+
## 2.0.0
44

55
### Added
66

@@ -10,8 +10,13 @@
1010
- `chartXAxisLabels`, `chartYAxisLabels`, `chartAxisFont`, `chartAxisColor`
1111
- `chartLineWidth`, `chartLineBackground`, `chartLineMarks`, `chartLineStyle`, `chartLineAnimation`
1212
- `chartInteractionValue`
13+
- `chartSelectionHandler`
14+
- `chartPerformance`
1315
- Immutable chart configuration structs and environment-key-based composition.
1416
- Updated docs/examples and generated showcase app.
17+
- Dynamic streaming data source support via `ChartStreamingDataSource`.
18+
- Unified X-axis alignment strategy shared across chart layers.
19+
- Apple privacy manifest for SDK distribution (`PrivacyInfo.xcprivacy`).
1520

1621
### Changed
1722

MIGRATION.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# SwiftUICharts Migration Guide
22

3+
## Target release
4+
5+
This guide targets `2.0.0`.
6+
7+
`2.0.0` is a major breaking release and phases out the old mutable chain API in favor of composable modifier-based configuration.
8+
39
## Version direction
410

511
This release moves to a strict SwiftUI-idiomatic modifier API.
@@ -8,6 +14,16 @@ This release moves to a strict SwiftUI-idiomatic modifier API.
814
- `ViewModifier` composition
915
- Environment keys instead of mutable reference state in view structs
1016

17+
## Migration checklist
18+
19+
1. Replace legacy chart types with `LineChart`, `BarChart`, `PieChart`, `RingsChart`.
20+
2. Replace old chain methods with `chart...` modifiers.
21+
3. Migrate interaction:
22+
- shared value model: `chartInteractionValue(_:)`
23+
- callback model: `chartSelectionHandler(_:)`
24+
4. Validate axis label/range behavior under the unified X-axis alignment model.
25+
5. Run `swift test` and build the showcase app to verify rendering parity.
26+
1127
## Old -> new mapping
1228

1329
### Previous chart data/range chains
@@ -54,6 +70,7 @@ This release moves to a strict SwiftUI-idiomatic modifier API.
5470
| --- | --- |
5571
| `.chartValue(...)` on chart views | `.chartInteractionValue(...)` on any parent container |
5672
| `@EnvironmentObject ChartValue` requirement | optional environment interaction value |
73+
| N/A | `.chartSelectionHandler { event in ... }` callback-based selection |
5774

5875
### Legacy public type replacements
5976

@@ -109,3 +126,25 @@ AxisLabels {
109126
}
110127
.chartXAxisLabels(["Q1", "Q2", "Q3", "Q4"])
111128
```
129+
130+
## Advanced migration examples
131+
132+
### Dynamic streaming data
133+
134+
```swift
135+
@ObservedObject private var stream = ChartStreamingDataSource(initialValues: [12, 14, 18, 16],
136+
windowSize: 8,
137+
autoScroll: true)
138+
139+
LineChart()
140+
.chartData(stream)
141+
.chartYRange(stream.suggestedYRange)
142+
```
143+
144+
### Performance mode for large datasets
145+
146+
```swift
147+
LineChart()
148+
.chartData(largeSeries)
149+
.chartPerformance(.automatic(threshold: 600, maxPoints: 180, simplifyLineStyle: true))
150+
```

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ SwiftUICharts is an open-source chart library for SwiftUI with iOS 13 compatibil
44

55
This release uses a fully composable, SwiftUI-idiomatic API based on immutable configuration and `ViewModifier` chains.
66

7+
## 2.0.0 Release
8+
9+
Version `2.0.0` is the new major composable release.
10+
11+
- New modifier-first API (`chartData`, `chartXRange`, `chartYRange`, `chartGridLines`, axis modifiers, line modifiers)
12+
- Shared X-axis alignment model across chart types
13+
- Optional interaction model (`chartInteractionValue`) and callback model (`chartSelectionHandler`)
14+
- Streaming data support (`ChartStreamingDataSource`)
15+
- Performance mode (`chartPerformance`)
16+
- Accessibility + high-contrast presets
17+
- Apple privacy manifest included for SDK distribution (`PrivacyInfo.xcprivacy`)
18+
719
<p align="center">
820
<img src="Resources/linevid2.gif" width="30%"/> <img src="Resources/barvid2.gif" width="30%"/> <img src="Resources/pievid2.gif" width="30%"/>
921
</p>
@@ -21,13 +33,34 @@ Use Swift Package Manager in Xcode and add:
2133

2234
`https://github.com/AppPear/ChartView`
2335

36+
For `2.0.0`, depend on the `2.0.0` tag or from `2.0.0` up to next major.
37+
2438
## Migration
2539

2640
This is a major composable API release.
2741

2842
- Previous chain APIs like `.data`, `.rangeX`, `.rangeY`, `.setAxisXLabels`, `.setNumberOfHorizontalLines`, and line-specific setters were replaced by typed chart modifiers.
2943
- Full old-to-new mapping: [MIGRATION.md](./MIGRATION.md)
3044

45+
## Migration In 3 Steps
46+
47+
1. Replace legacy view types (`LineChartView`, `BarChartView`, `PieChartView`, `MultiLineChartView`) with composable chart views.
48+
2. Replace old chain methods with new modifiers.
49+
3. Move interaction to container-level wiring:
50+
- shared state: `.chartInteractionValue(ChartValue())`
51+
- callback-driven: `.chartSelectionHandler { event in ... }`
52+
53+
### Common replacements
54+
55+
| Old | New |
56+
| --- | --- |
57+
| `.data([Double])` | `.chartData([Double])` |
58+
| `.rangeX(...)` | `.chartXRange(...)` |
59+
| `.rangeY(...)` | `.chartYRange(...)` |
60+
| `.setNumberOfHorizontalLines(h)` | `.chartGridLines(horizontal: h, vertical: ...)` |
61+
| `.setAxisXLabels(...)` | `.chartXAxisLabels(...)` |
62+
| `.showChartMarks(...)` | `.chartLineMarks(...)` |
63+
3164
## Quick Start
3265

3366
**Simple line chart**
@@ -122,3 +155,8 @@ AxisLabels {
122155
## Full Examples
123156

124157
See [example.md](./example.md) and [`Examples/SwiftUIChartsShowcase`](./Examples/SwiftUIChartsShowcase) for complete showcase code.
158+
159+
## Release Notes
160+
161+
- Changelog: [CHANGELOG.md](./CHANGELOG.md)
162+
- Migration details: [MIGRATION.md](./MIGRATION.md)

example.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
### Example codes (modifier-based composable API)
44

5+
## Notes for 2.0.0 usage
6+
7+
- Use modifier APIs only (`chartData`, `chartXRange`, `chartYRange`, `chartGridLines`, `chartXAxisLabels`, etc.).
8+
- Use `chartInteractionValue(_:)` when you want shared interaction state.
9+
- Use `chartSelectionHandler(_:)` when you prefer callback-based interaction events.
10+
- Use `ChartStreamingDataSource` for dynamic feeds and `chartPerformance(_:)` for large datasets.
11+
512
<p align="left">
613
<img src="Resources/linechartcard.png" width="400px"/>
714
</p>

0 commit comments

Comments
 (0)