You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The BarChart has been rewritten from the ground up. It works the same as before
4
-
but have some nice new features. The expectation on the `data` props has changed to better align with the other charts APIs, see the README and [examples](https://github.com/JesperLekland/react-native-svg-charts-examples) for more info.
2
+
***Support for styles xAxis labels**
5
3
6
-
***Complex objects**
4
+
XAxis now supports complex data argument with `svg` property to style each label individually. See [examples repo](https://github.com/JesperLekland/react-native-svg-charts-examples) for usage.
5
+
Thanks to @fqueiruga for this ❤️
7
6
8
-
As before you can still pass in an array of just numbers, but you can now also pass in an array of complex objects! These objects can contain any data you want but you must also
9
-
pass in a `yAccessor` prop to tell the chart what the actual value for the item is (same as Line/AreaChart).
10
-
The entire object will be returned to you as `item` in the `renderDecorator` callback, allowing for nice label rendering.
11
-
The BarChart looks for a `svg` property on each entry, allowing you to set custom svg props for each bar (!!!).
12
-
The BarChart itself also takes an svg prop that will be passed to all bars (item specific svg properties will not be overriden)
13
7
14
-
All in all you should be able to do what you did before, and then some 😄 Check out the [examples repo](https://github.com/JesperLekland/react-native-svg-charts-examples) for some nice use examples
8
+
***Support for backgroundColor in ProgressCircle**
15
9
10
+
You can now customize the progress "background" color
16
11
17
-
***Horizontal support**
12
+
***Support for strokeWidth in ProgressCircle**
18
13
19
-
`horizontal={true}`, how nice is that!? 😄 Supports both the standard barChart and the grouped one (multiple data sets).
20
-
21
-
***Extras support**
22
-
23
-
BarChart now has first class support for the extras prop.
24
-
Render a clip path or a gradient in a specific bar, up to you!
25
-
26
-
***Spacing is replaced**
27
-
28
-
We've replaced `spacing` with `spacingInner` and `spacingOuter` to give more control to the user. Same default as before - 0.05
29
-
This is true for all places where `spacing` was being used.
30
-
31
-
### YAxis supports scaleBand and spacing
32
-
33
-
In order to have a nice YAxis along with the horizontal BarChart we have now added support for `scale=d3.scaleBand` to the yAxis.
34
-
This in turn comes with added props `spacingInner` and `spacingOuter` to align nicely with your BarChart.
35
-
36
-
37
-
### PieChart
38
-
39
-
***data entry supports `svg` prop**
40
-
41
-
PieChart has been upgraded to take the `svg` prop on each data entry, allowing you to customise your PieChart even further
42
-
We've also added the `valueAccessor` prop to allow you to use different dataStructures, not forcing you to name the value "value" and aligning with the other APIs.
43
-
44
-
***data entry supports `arc` prop**
45
-
46
-
You can now customize your arcs on an individual level. Want one arc to be bigger than the reset? No problem!
47
-
48
-
Check out [examples repo](https://github.com/JesperLekland/react-native-svg-charts-examples) for examples
49
-
50
-
### WaterfallChart is removed
51
-
52
-
Due to low usage and high maintenance the WaterfallChart is removed.
53
-
54
-
### Cleaned up README
55
-
56
-
The README is now more focused on the basic usage of this library. Any cool custom behavior has been moved to the [examples repo](https://github.com/JesperLekland/react-native-svg-charts-examples).
57
-
This is the go to place where you want inspiration on how to do cool things with your charts or if you've ever asked yourself "can I do this with react-native-svg-charts?"
58
-
59
-
We want to make sure that the README is concise and to the point. Here we want to explain the APIs and not much more.
60
-
All charts and their APIs will still be documented here, but as an MVP.
14
+
Customize the width of the ProgressCircle
61
15
16
+
***Prettier transition in ProgressCircle from progress to background**
62
17
18
+
Old implementation used to have a small cutoff between the progress and the background.
19
+
Now the progress seems to be "inside" the circle instead.
Copy file name to clipboardexpand all lines: README.md
+14-8
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ yarn storybook
72
72
| data |**required**| An array of arbitrary data - use prop `xAccessor`/`yAccessor`to tell the chart about the data structure|
73
73
| yAccessor | ({ item }) => item | A function that takes each entry of `data` (named "item") as well as the index and returns the y-value of that entry |
74
74
| xAccessor | ({ index }) => index | Same as `yAccessor` but returns the x-value of that entry|
75
-
| yScale | d3Scale.scaleLinear | A function that determines the scale of said axis (only tested with scaleLinear, scaleTime & scaleBand )|
75
+
| yScale | d3Scale.scaleLinear | A function that determines the scale of said axis (only tested with scaleLinear, scaleTime & scaleBand )|
76
76
| xScale | d3Scale.scaleLinear | Same as `yScale` but for the x axis |
77
77
| svg |`{}`| an object containing all the props that should be passed down to the underlying `react-native-svg` component. [See available props](https://github.com/react-native-community/react-native-svg#common-props)|
78
78
| animate | true | PropTypes.bool |
@@ -257,8 +257,9 @@ Also see [Common Props](#common-props)
257
257
258
258
| Property | Default | Description |
259
259
| --- | --- | --- |
260
-
| data |**required**| The data prop in a barChart can look exactly like in a Line- or AreaChart, i.e an array of just numbers or complex objects. It can however also be an array with several data sets. See [the examples repo](https://github.com/JesperLekland/react-native-svg-charts-examples)|
260
+
| data |**required**| The data prop in a barChart can look exactly like in a Line- or AreaChart, i.e an array of just numbers or complex objects. It can however also be an array with several data sets. A data object can contain a `svg` property which allows you two override styles on that specific object. See [the examples repo](https://github.com/JesperLekland/react-native-svg-charts-examples)|
261
261
| horizontal | false | Boolean whether or not the bars should be horizontal |
262
+
| svg |`{}`| Default svg props **for all bars**. Supports all svg props an svg path normally supports. This styles will be overriden if there are specific styles for a given data object |
262
263
| spacingInner | 0.05 | Spacing between the bars (or groups of bars) |
263
264
| spacingOuter | 0.05 | Spacing outside of the bars (or groups of bars). Percentage of one bars width |
@@ -524,6 +527,8 @@ class YAxisExample extends React.PureComponent {
524
527
| --- | --- | --- |
525
528
| scale |`d3Scale.scaleLinear`| Should be the same as passed into the charts `yScale`, *or* d3Scale.scaleBand if used in conjunction with a horizontal BarChart |
526
529
| svg |`{}`| supports all svg props an svg text normally supports |
530
+
| spacingInner | 0.05 | Spacing between the labels. Only applicable if `scale=d3Scale.scaleBand` and should then be equal to `spacingInner` prop on the actual BarChart |
531
+
| spacingOuter | 0.05 | Spacing outside of the labels. Only applicable if `scale=d3Scale.scaleBand` and should then be equal to `spacingOuter` prop on the actual BarChart |
527
532
| formatLabel |`value => {}`| A utility function to format the text before it is displayed, e.g `value => "$" + value |
528
533
| contentInset | { top: 0, bottom: 0 } | Used to sync layout with chart (if same prop used there) |
529
534
| min | undefined | Used to sync layout with chart (if gridMin is used there) |
@@ -580,11 +585,12 @@ class XAxisExample extends React.PureComponent {
580
585
581
586
| Property | Default | Description |
582
587
| --- | --- | --- |
583
-
|values|**required**| An array of values to render on the xAxis. Should preferably have the same length as the chart's dataPoints. |
588
+
|data|**required**| An array of values or objects to render on the xAxis. Should preferably have the same length as the chart's dataPoints. If a complex object is used instead of a simple value, a `xAccessor` prop **is required** to calculate the axis' extent. A data object can contain a `svg` property which allows you to override styles on that specific object |
584
589
| scale |`d3Scale.scaleLinear`| Should be the same as passed into the charts `xScale`|
585
-
| spacing | 0.05 | Only applicable if `scale=d3Scale.scaleBand` and should then be equal to `spacing` prop on the actual BarChart. |
586
-
| svg |`{}`| supports all svg props an svg text normally supports |
587
-
| formatLabel |`value => value`| A utility function to format the text before it is displayed, e.g `value => "day" + value. Passes back the value provided by the `xAccessor` |
590
+
| spacingInner | 0.05 | Spacing between the labels. Only applicable if `scale=d3Scale.scaleBand` and should then be equal to `spacingInner` prop on the actual BarChart |
591
+
| spacingOuter | 0.05 | Spacing between the labels. Only applicable if `scale=d3Scale.scaleBand` and should then be equal to `spacingOuter` prop on the actual BarChart |
592
+
| svg |`{}`| Default svg props **for all labels**. Supports all svg props an svg text normally supports. This styles will be overriden if there are specific styles for a given data object |
593
+
| formatLabel |`value => value`| A utility function to format the text before it is displayed, e.g `value => "day" + value`. Passes back the value provided by the `xAccessor`|
588
594
| contentInset | { left: 0, right: 0 } | Used to sync layout with chart (if same prop used there) |
589
595
590
596
@@ -630,8 +636,8 @@ There might be additional parameters sent to the `extras` functions as well, dep
630
636
631
637
The`LineChart`passesthesvgpathdatathatrenderedtheline. (argument name `line`)
0 commit comments