react-native-echarts/example/index.ios.js

62 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2016-10-21 07:05:57 +00:00
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
2016-10-21 07:54:29 +00:00
import Echarts from 'native-echarts';
2016-10-21 07:05:57 +00:00
export default class app2 extends Component {
render() {
2016-10-21 07:54:29 +00:00
const option = {
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
};
2016-10-21 07:05:57 +00:00
return (
<View style={styles.container}>
<Text style={styles.welcome}>
2016-10-21 07:54:29 +00:00
Welcome to React Native Echarts!
2016-10-21 07:05:57 +00:00
</Text>
2016-10-21 07:54:29 +00:00
<Echarts option={option} height={300} />
2016-10-21 07:05:57 +00:00
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
2016-10-21 07:54:29 +00:00
margin: 30,
2016-10-21 07:05:57 +00:00
},
});
AppRegistry.registerComponent('app2', () => app2);