update readme

This commit is contained in:
somonus 2016-11-03 10:55:11 +08:00
parent 73570100e3
commit cd12da9679
5 changed files with 66 additions and 21 deletions

View File

@ -75,12 +75,16 @@ npm start
运行截图:
![image](https://github.com/somonus/react-native-echarts/blob/master/example/demo.png)
![image](https://github.com/somonus/react-native-echarts/blob/master/example/demoIOS.png)
### Android
使用Android studio打开Android目录点击run
运行截图:
![image](https://github.com/somonus/react-native-echarts/blob/master/example/demoAndroid.png)
## License
native-echarts is released under the MIT license.

BIN
example/demoAndroid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -9,36 +9,71 @@ import {
AppRegistry,
StyleSheet,
Text,
View
View,
TouchableOpacity
} from 'react-native';
import Echarts from 'native-echarts';
export default class app2 extends Component {
render() {
const option = {
title: {
text: 'ECharts 入门示例'
constructor(props) {
super(props);
this.state = {
option : {
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
text: 'test'
};
}
changeOption() {
this.setState({
option: {
title: {
text: 'New Chart'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'line',
data: [5, 20, 36, 10, 10, 20]
}]
}
})
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native Echarts!
</Text>
<Echarts option={option} height={300} />
<TouchableOpacity style={styles.button} onPress={this.changeOption.bind(this)}>
<Text style={{color: '#fff'}}>change state</Text>
</TouchableOpacity>
<Echarts option={this.state.option} height={300} />
</View>
);
}
@ -56,6 +91,12 @@ const styles = StyleSheet.create({
textAlign: 'center',
margin: 30,
},
button: {
backgroundColor: '#d9534f',
padding: 8,
borderRadius: 4,
marginBottom: 20
}
});
AppRegistry.registerComponent('app2', () => app2);

View File

@ -1,6 +1,6 @@
{
"name": "native-echarts",
"version": "0.2.0",
"version": "0.3.0",
"description": "echarts for react-native",
"main": "src/index.js",
"directories": {