forked from JesperLekland/react-native-svg-charts-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
layered-charts.js
37 lines (31 loc) · 1.2 KB
/
layered-charts.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
import React from 'react'
import { AreaChart, Grid } from 'react-native-svg-charts'
import * as shape from 'd3-shape'
import { StyleSheet, View } from 'react-native'
class LayeredChartsExample extends React.PureComponent {
render() {
const data = [ 50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80 ]
const data2 = [ 50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80 ].reverse()
return (
<View style={ { height: 200 } }>
<AreaChart
style={ { flex: 1 } }
data={ data }
svg={{ fill: 'rgba(134, 65, 244, 0.5)' }}
contentInset={ { top: 20, bottom: 20 } }
curve={ shape.curveNatural }
>
<Grid/>
</AreaChart>
<AreaChart
style={ StyleSheet.absoluteFill }
data={ data2 }
svg={{ fill: 'rgba(34, 128, 176, 0.5)' }}
contentInset={ { top: 20, bottom: 20 } }
curve={ shape.curveNatural }
/>
</View>
)
}
}
export default LayeredChartsExample