-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathChartsPage.js
92 lines (87 loc) · 2.42 KB
/
ChartsPage.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import React from "react";
import { TouchableOpacity, View, Dimensions } from "react-native";
import { createStackNavigator } from "react-navigation";
import { Ionicons } from "@expo/vector-icons";
import { LineChart, ProgressChart } from "react-native-chart-kit";
class ChartsPage extends React.Component {
render() {
return (
<View
style={{
flex: 1,
padding: 5,
backgroundColor: "#eee"
}}
>
<LineChart
data={{
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
datasets: [
{
data: [
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100,
Math.random() * 100
]
}
]
}}
width={Dimensions.get("window").width - 10} // from react-native
height={320}
chartConfig={{
backgroundColor: "#e26a00",
backgroundGradientFrom: "#fb8c00",
backgroundGradientTo: "#ffa726",
decimalPlaces: 2, // optional, defaults to 2dp
color: (opacity = 1) => `rgba(33, 29, 27, ${opacity})`,
style: {
borderRadius: 16
}
}}
bezier
style={{
marginVertical: 8,
borderRadius: 16
}}
/>
<ProgressChart
data={[0.4, 0.6, 0.8]}
width={Dimensions.get("window").width - 10}
height={220}
chartConfig={{
backgroundColor: "#e26a00",
backgroundGradientFrom: "#fb8c00",
backgroundGradientTo: "#ffa726",
decimalPlaces: 2, // optional, defaults to 2dp
color: (opacity = 1) => `rgba(33, 29, 27, ${opacity})`,
style: {
borderRadius: 16
}
}}
/>
</View>
);
}
}
export default (ChartsStack = createStackNavigator({
ChartsPage: {
screen: ChartsPage,
navigationOptions: ({ navigation }) => ({
headerTitle: "Graph",
headerLeft: (
<View>
<TouchableOpacity
onPress={() => {
navigation.toggleDrawer();
}}
>
<Ionicons name="md-menu" size={35} />
</TouchableOpacity>
</View>
)
})
}
}));