1.0.8 • Published 3 years ago

react-native-charting v1.0.8

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

react-native-charting

Originally forked from native-echarts.

react-native-charting uses Echarts.

Works for both iOS & Android using WebView.

Install

$ yarn add react-native-charting

react-native-webview is a peer dependency. If you are not already using it in your project, then please go here to install it too react-native-webview

Android

Copy ./node_modules/react-native-charting/src/components/Echarts/echart.html to ./android/app/src/main/assets/. Don't remove ./node_modules/react-native-charting/src/components/Echarts/echart.html.

iOS

Nothing else to do.

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.
  • onPress (function): Returns event object.
  • onDataZoom (function): Returns event object.
import React, { Component } from 'react'
import { AppRegistry, StyleSheet, Text, View } from 'react-native'
import Echarts from 'react-native-charting'

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}
        onPress={(params) => console.log(params)}
      />
    )
  }
}

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

IOS

image

Android

image

License

react-native-charting is released under the MIT license.

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.3.0

4 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

6 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago