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