react-native-secharts
一个webview封装的图表组件。基于百度echarts3
安装步骤:
- 安装依赖
yarn add react-native-secharts
或者
npm install react-native-secharts --save
- 修复android release bug
- 将node_modules/react-native-secharts/echarts 文件夹
- 移动至项目 android/app/src/main/assets文件夹下
- 引用组件
import Echarts from 'react-native-secharts';
- 使用组件
<Echarts option={{}} height={400}/>
使用组件
请看example文件夹中示例代码 运行示例
$ cd example
$ yarn
$ react-native run-ios 或者 $ react-native run-android
props:
属性 | 类型 | 默认值 | 备注 |
---|---|---|---|
option | obj | null | echarts3配置项,请参考echarts3官网 |
backgroundColor | string | 'rgba(0,0,0,0)' | 图表画布背景色 |
width | number | 'auto' | 画布宽度 |
height | number | 400 | 画布高度 |
renderLoading | func | ()=><View style={{backgroundColor: 'rgba(0,0,0,0)'}}/> | loading时遮罩 |