Skip to content

Commit cd12da9

Browse files
committed
update readme
1 parent 7357010 commit cd12da9

File tree

5 files changed

+66
-21
lines changed

5 files changed

+66
-21
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,16 @@ npm start
7575

7676
运行截图:
7777

78-
![image](https://github.com/somonus/react-native-echarts/blob/master/example/demo.png)
78+
![image](https://github.com/somonus/react-native-echarts/blob/master/example/demoIOS.png)
7979

8080
### Android
8181

8282
使用Android studio打开Android目录,点击run
8383

84+
运行截图:
85+
86+
![image](https://github.com/somonus/react-native-echarts/blob/master/example/demoAndroid.png)
87+
8488
## License
8589

8690
native-echarts is released under the MIT license.

example/demoAndroid.png

80.4 KB
Loading
File renamed without changes.

example/index.android.js

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,71 @@ import {
99
AppRegistry,
1010
StyleSheet,
1111
Text,
12-
View
12+
View,
13+
TouchableOpacity
1314
} from 'react-native';
1415
import Echarts from 'native-echarts';
1516

1617
export default class app2 extends Component {
17-
render() {
18-
const option = {
19-
title: {
20-
text: 'ECharts 入门示例'
21-
},
22-
tooltip: {},
23-
legend: {
24-
data:['销量']
25-
},
26-
xAxis: {
27-
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
18+
constructor(props) {
19+
super(props);
20+
21+
this.state = {
22+
option : {
23+
title: {
24+
text: 'ECharts 入门示例'
25+
},
26+
tooltip: {},
27+
legend: {
28+
data:['销量']
29+
},
30+
xAxis: {
31+
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
32+
},
33+
yAxis: {},
34+
series: [{
35+
name: '销量',
36+
type: 'bar',
37+
data: [5, 20, 36, 10, 10, 20]
38+
}]
2839
},
29-
yAxis: {},
30-
series: [{
31-
name: '销量',
32-
type: 'bar',
33-
data: [5, 20, 36, 10, 10, 20]
34-
}]
40+
text: 'test'
3541
};
42+
}
43+
44+
changeOption() {
45+
this.setState({
46+
option: {
47+
title: {
48+
text: 'New Chart'
49+
},
50+
tooltip: {},
51+
legend: {
52+
data:['销量']
53+
},
54+
xAxis: {
55+
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
56+
},
57+
yAxis: {},
58+
series: [{
59+
name: '销量',
60+
type: 'line',
61+
data: [5, 20, 36, 10, 10, 20]
62+
}]
63+
}
64+
})
65+
}
66+
67+
render() {
3668
return (
3769
<View style={styles.container}>
3870
<Text style={styles.welcome}>
3971
Welcome to React Native Echarts!
4072
</Text>
41-
<Echarts option={option} height={300} />
73+
<TouchableOpacity style={styles.button} onPress={this.changeOption.bind(this)}>
74+
<Text style={{color: '#fff'}}>change state</Text>
75+
</TouchableOpacity>
76+
<Echarts option={this.state.option} height={300} />
4277
</View>
4378
);
4479
}
@@ -56,6 +91,12 @@ const styles = StyleSheet.create({
5691
textAlign: 'center',
5792
margin: 30,
5893
},
94+
button: {
95+
backgroundColor: '#d9534f',
96+
padding: 8,
97+
borderRadius: 4,
98+
marginBottom: 20
99+
}
59100
});
60101

61102
AppRegistry.registerComponent('app2', () => app2);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "native-echarts",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "echarts for react-native",
55
"main": "src/index.js",
66
"directories": {

0 commit comments

Comments
 (0)