Skip to content

AndyAdolf2100/react-native-echarts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

native-echarts

NPM Version npm License

install

$ npm install native-echarts --save

Usage

The Usage is complete consistent with Echarts

component props:

  • option (object): The option for echarts: Documentation
  • width (number): The width of the chart. The default value is the outer container width.
  • height (number): The height of the chart. The default value is 400.
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';
import Echarts from 'native-echarts';

export default class app extends Component {
  render() {
    const option = {
      title: {
          text: 'ECharts demo'
      },
      tooltip: {},
      legend: {
          data:['销量']
      },
      xAxis: {
          data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
      },
      yAxis: {},
      series: [{
          name: '销量',
          type: 'bar',
          data: [5, 20, 36, 10, 10, 20]
      }]
    };
    return (
      <Echarts option={option} height={300} />
    );
  }
}

AppRegistry.registerComponent('app', () => app);

##Example

run demo

cd example
npm install
npm start

IOS

Open the xcode project in the ios directory and click run

screenshots:

image

Android

Open the Android project in the android directory with Android Studio and click run.

screenshots:

image

License

native-echarts is released under the MIT license.

注意

每次添加新的组件的时候,node_modules/native-echarts/src/components/Echarts/renderChart.js click事件要加return Android和iOS打包都会出现无法加载K线网页的问题 暂时用CDN来做 debug正常,但是release还是不显示

WebView: /node_modules/native-echarts/components/Echarts/index.js

const source = {'uri':'http://siweitech.b0.upaiyun.com/tpl.html'
...
source={source}
...

About

react-native-echarts自定义版本

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages