gf-rn-echarts

0.4.5 • Public • Published

gf-rn-echarts

NPM Version npm License

This repo is fork from react-native-echarts

install

$ npm install gf-rn-echarts --save

Usage

The Usage is complete consistent with Echarts

component props:

  • echartUrl (string): The url of echarts code file, it may be a cdn address.
  • 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 {
  const echartUrl = 'https://cdn.bootcss.com/echarts/3.3.2/echarts.min.js';
  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 echartUrl={echartUrl} 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.

Package Sidebar

Install

npm i gf-rn-echarts

Weekly Downloads

3

Version

0.4.5

License

MIT

Unpacked Size

1.35 MB

Total Files

55

Last publish

Collaborators

  • willywang