forked from JesperLekland/react-native-svg-charts-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwith-multiple-data-sets.js
43 lines (36 loc) · 1.14 KB
/
with-multiple-data-sets.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react'
import { BarChart, Grid } from 'react-native-svg-charts'
class GroupedBarChartExample extends React.PureComponent {
render() {
const data1 = [ 14, -1, 100, -95, -94, -24, -8, 85, -91, 35, -53, 53, -78, 66, 96, 33, -26, -32, 73, 8 ]
.map((value) => ({ value }))
const data2 = [ 24, 28, 93, 77, -42, -62, 52, -87, 21, 53, -78, -62, -72, -6, 89, -70, -94, 10, 86, 84 ]
.map((value) => ({ value }))
const barData = [
{
data: data1,
svg: {
fill: 'rgb(134, 65, 244)',
},
},
{
data: data2,
},
]
return (
<BarChart
style={ { height: 200 } }
data={ barData }
yAccessor={({ item }) => item.value}
svg={{
fill: 'green',
}}
contentInset={ { top: 30, bottom: 30 } }
{ ...this.props }
>
<Grid/>
</BarChart>
)
}
}
export default GroupedBarChartExample