-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathscale-band.js
33 lines (27 loc) · 889 Bytes
/
scale-band.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
import React from 'react'
import { BarChart, XAxis } from 'react-native-svg-charts'
import { View } from 'react-native'
import * as scale from 'd3-scale'
class XAxisExample extends React.PureComponent {
render() {
const data = [ 14, 80, 100, 55 ]
return (
<View style={{ height: 200, padding: 20 }}>
<BarChart
style={{ flex: 1 }}
data={data}
gridMin={0}
svg={{ fill: 'rgb(134, 65, 244)' }}
/>
<XAxis
style={{ marginTop: 10 }}
data={ data }
scale={scale.scaleBand}
formatLabel={ (value, index) => index }
labelStyle={ { color: 'black' } }
/>
</View>
)
}
}
export default XAxisExample