zoukankan      html  css  js  c++  java
  • native-echarts 组件封装

    CommunalChart.js

    /**
     * 封装 图表组件
     */
    import React, { Component } from 'react';
    import {
        StyleSheet,
        Text,
        View,
        Image,
        Platform,
        Dimensions,
        DeviceEventEmitter, // 通知
    } from 'react-native';
    
    import PropTypes from 'prop-types';
    
    // 获取屏幕宽高
    const {width, height} = Dimensions.get('window');
    
    // 引入 echart组件
    import Echarts from 'native-echarts';
     
    export default class CommunalChart extends Component {
        // 定义成员属性
        static propTypes = {
            title:PropTypes.string, // 标题
            legend:PropTypes.array, 
            statistics:PropTypes.array // 数据
        };
    
        onPressone(data){
            // 发送通知
            DeviceEventEmitter.emit('responseName', data);
        }
    
        // 渲染
        render() {
            const option = {
                title : {
                    text: '',
                    x:'center',
                },
                tooltip : {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    data: this.props.legend,
                    y:'90'
                },
                series : [
                    {
                        name: '人数',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '60%'],
                        data: this.props.statistics,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            };
    
            return (
                <Echarts option={option} height={height} onPressone={(data) => {this.onPressone(data)}} />
            );
        }
    }
    

    .

  • 相关阅读:
    solr部署长命版后继
    reiserfs相关
    sqlite in python
    查看文件系统
    https://wiki.fourkitchens.com/dashboard.action这个技术wiki不错
    gvim菜单显示问题
    linux tips
    solr部署一气呵成版,让你多活两天
    挺好玩的C语句
    hardy ubuntu source list
  • 原文地址:https://www.cnblogs.com/crazycode2/p/7476134.html
Copyright © 2011-2022 走看看