Skip to content
This repository was archived by the owner on Sep 17, 2021. It is now read-only.

Commit 7eeb441

Browse files
committed
2 parents d31d83b + bbd34d0 commit 7eeb441

File tree

5 files changed

+8164
-2
lines changed

5 files changed

+8164
-2
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Logs
22
logs
33
*.log
4+
.history
45

56
# Runtime data
67
pids

Diff for: example/src/App.js

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import SideMenu from 'react-native-side-menu'
2626
import BarChartColumnBasic from './bar/BarChartColumnBasic'
2727

2828
import PieChartBasic from './pie/PieChartBasic'
29+
import PieChartBasicAnimation from './pie/PieChartBasicAnimation'
2930

3031
import StockLineChartBasic from './stockline/StockLineChartBasic'
3132
import StockLineChartStaticTickLabels from './stockline/StockLineChartStaticTickLabels'
@@ -71,6 +72,10 @@ class HomeScreen extends React.Component {
7172
onPress={() => navigate('PieChartBasic')}
7273
title="Pie - Basic"
7374
/>
75+
<Button
76+
onPress={() => navigate('PieChartBasicAnimation')}
77+
title="Pie - Basic Animation"
78+
/>
7479
<Button
7580
onPress={() => navigate('StockLineChartBasic')}
7681
title="StockLine - Basic"
@@ -124,6 +129,7 @@ const App = StackNavigator({
124129
Home: { screen: HomeScreen },
125130
BarChartColumnBasic: { screen: BarChartColumnBasic },
126131
PieChartBasic: { screen: PieChartBasic },
132+
PieChartBasicAnimation: { screen: PieChartBasicAnimation },
127133
StockLineChartBasic: { screen: StockLineChartBasic },
128134
StockLineChartStaticTickLabels: { screen: StockLineChartStaticTickLabels },
129135
StockLineChartDynamicTickLabels: { screen: StockLineChartDynamicTickLabels },

Diff for: example/src/pie/PieChartBasicAnimation.js

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
Copyright 2016 Capital One Services, LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and limitations under the License.
14+
15+
SPDX-Copyright: Copyright (c) Capital One Services, LLC
16+
SPDX-License-Identifier: Apache-2.0
17+
*/
18+
19+
'use strict'
20+
21+
import React, { Component } from 'react';
22+
import { View, Text, StyleSheet } from 'react-native';
23+
24+
import { Pie } from 'react-native-pathjs-charts'
25+
26+
const styles = StyleSheet.create({
27+
container: {
28+
29+
flex: 1,
30+
justifyContent: 'center',
31+
alignItems: 'center',
32+
backgroundColor: '#f7f7f7',
33+
},
34+
});
35+
36+
class PieChartBasicAnimation extends Component {
37+
static navigationOptions = ({ navigation }) => ({
38+
title: `Pie - Basic - Animation`,
39+
});
40+
render() {
41+
let data = [{
42+
"name": "Washington",
43+
"population": 7694980
44+
},
45+
{
46+
"name": "Oregon",
47+
"population": 2584160
48+
}, {
49+
"name": "Minnesota",
50+
"population": 6590667,
51+
"color": {'r':223,'g':154,'b':20}
52+
}, {
53+
"name": "Alaska",
54+
"population": 7284698
55+
}
56+
]
57+
58+
let options = {
59+
margin: {
60+
top: 20,
61+
left: 20,
62+
right: 20,
63+
bottom: 20
64+
},
65+
width: 350,
66+
height: 350,
67+
color: '#2980B9',
68+
r: 50,
69+
R: 150,
70+
legendPosition: 'topLeft',
71+
animate: {
72+
enabled: true,
73+
type: 'oneByOne',
74+
duration: 200,
75+
fillTransition: 3
76+
},
77+
label: {
78+
fontFamily: 'Arial',
79+
fontSize: 8,
80+
fontWeight: true,
81+
color: '#ECF0F1'
82+
}
83+
}
84+
85+
return (
86+
<View style={styles.container}>
87+
<Pie data={data}
88+
89+
options={options}
90+
accessorKey="population"
91+
margin={{ top: 20, left: 20, right: 20, bottom: 20 }}
92+
color="#2980B9"
93+
pallete={
94+
[
95+
{ 'r': 25, 'g': 99, 'b': 201 },
96+
{ 'r': 24, 'g': 175, 'b': 35 },
97+
{ 'r': 190, 'g': 31, 'b': 69 },
98+
{ 'r': 100, 'g': 36, 'b': 199 },
99+
{ 'r': 214, 'g': 207, 'b': 32 },
100+
{ 'r': 198, 'g': 84, 'b': 45 }
101+
]
102+
}
103+
r={50}
104+
R={150}
105+
legendPosition="topLeft"
106+
label={{
107+
fontFamily: 'Arial',
108+
fontSize: 8,
109+
fontWeight: true,
110+
color: '#ECF0F1'
111+
}}
112+
/>
113+
</View>
114+
)
115+
}
116+
}
117+
118+
export default PieChartBasicAnimation;

0 commit comments

Comments
 (0)