Skip to content

Commit 30026e5

Browse files
Feature/chart children (#112)
* updated all charts to support `children`. Deprecated the use of `Decorators`, `Extras` and the `renderGrid` prop * migrate ProgressCircle to new children api * migrate piechart to new api * update changelog * update readme * cleanup * update readme * update readme * fix piechart and progress circle. fix #110 * bump version to 5.0.0 * lint fixes
1 parent fb29199 commit 30026e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+600
-362
lines changed

CHANGELOG.md

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,46 @@
11

2-
* **Support for horizontal StackedBarChart**
2+
Version 5.0 is a major overhaul to the "decorator" and "extras" pattern.
3+
We've simplified the API, made it declarative and added support for
4+
rendering order.
35

4-
StackedBarChart now supports the prop `horizontal`
5-
just as a regular BarChart
6+
All charts and axes now support React children. Meaning that your decorators
7+
and extras should now be placed as direct children to the chart in question.
8+
This is a breaking change but a very easy one to migrate (I migrated all storybooks in a matter of minutes),
9+
see the [examples repo](https://github.com/JesperLekland/react-native-svg-charts-examples)
10+
and read the [docs](https://github.com/JesperLekland/react-native-svg-charts#react-native-svg-charts) for inspiration.
611

12+
I want to thank everyone who is contributing by submitting issues and joining
13+
in on discussions. A special thanks to @narciero, @Sprit3Dan and @RoarRain for
14+
contributing with PRs.
715

8-
* **StackedBar/AreaChart adheres to new `extras` api**
16+
## Breaking Changes
17+
* **Extras and Decorators have been removed**
18+
19+
Extras and decorators should now be passed in as children to the chart in question.
20+
Each child will be called with similar arguments as before. See
21+
[README](https://github.com/JesperLekland/react-native-svg-charts#react-native-svg-charts)
22+
for more info.
23+
24+
Migrating an extra is as simple as just moving it from the `extras` array to a child of the chart.
25+
The `decorators` are nearly as easy to migrate. Create a wrapper component around
26+
your decorator that accepts the `data` prop, now you yourself can map this array and return as many decorators as you want.
27+
28+
29+
* **renderGrid and gridProps have been removed**
30+
31+
A grid show now be rendered through as a child. We still expose a default `Grid`
32+
component as part of the API but this must no manually be added to all charts that want to display a grid.
33+
34+
As a result of this the following props are deprecated:
35+
* `showGrid`
36+
* `gridProps`
37+
* `renderGrid`
38+
39+
40+
* **Grids are consolidate into one**
41+
42+
Before we hade `Grid.Vertical`,`Grid.Horizontal` and `Grid.Both`,
43+
now we simply have `Grid` with a `direction` property. See [README](https://github.com/JesperLekland/react-native-svg-charts#react-native-svg-charts)
44+
for more info
945

10-
StackedBarChart and StackedAreaChart was still on the legacy `renderExtras`
11-
pattern. It has now been migrated to the single `extras` prop api.
1246

0 commit comments

Comments
 (0)