在react-native中使用echart绘制图表

引用自:https://www.jianshu.com/p/6eae23b3ece9.
有前辈做好了echart的封装
native-echarts.
cd到你项目目录,然后通过npm install native-echarts --save去安装

在需要调用的界面import Echarts from 'native-echarts’可以调用
代码与效果图如下:

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 *Copyright © 2017年 张宇. All rights reserved.
 */

import React, {
    Component } from 'react';
import {
   
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

import Echarts from 'native-echarts';

export default class ECharts extends Component {
   
  render() {
   
    const option = {
   
      title: {
   
          text: '销量统计表'
      },
      tooltip: {
   },
      legend: {
   
          data:['销量']
      },
      xAxis: {
   
          data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
      

你可能感兴趣的:(在react-native中使用echart绘制图表)