npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-echarts-component

v1.0.0

Published

react-native-echarts-component

Downloads

2

Readme

react-native-echarts-component

1.基于echarts本身功能订制化成react-native端, 功能完全兼容

2.对比native-echarts组件

2.1 支持 Map类型地图图表

2.2 解决android tpl.html文件引入问题

3.组件式调用,相对于配置的方式更符合 react 的开发习惯

安装

npm install react-native-echarts-component

使用

import {Echart, Components, Theme} from 'react-native-echarts-component'

const {dark, shine, infographic, macarons, roma, vintage} = Theme
const {XAxis, YAxis, Series} = Components

class Example extends React.Component {
    render() {
        return (
            <Echart>
                <YAxis type="value" />
                <XAxis type="category" data={['1', '2', '3', '4', '5', '6', '7']} />
                <Series type="line" smooth={true} data={[820, 932, 901, 934, 1290, 1330, 1320]} />
            </Echart>
        )
    }
}

组件

  • Echart 根组件
  • others 配置子组件
// option
const option = {
    title: {
        text: '未来一周气温变化',
        subtext: '纯属虚构'
    },
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data: ['最高气温', '最低气温']
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            },
            dataView: {readOnly: false},
            magicType: {type: ['line', 'bar']},
            restore: {},
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
    },
    yAxis: {
        type: 'value',
        axisLabel: {
            formatter: '{value} °C'
        }
    },
    series: [
        {
            name: '最高气温',
            type: 'line',
            data: [10, 11, 13, 11, 12, 12, 9],
            markPoint: {
                data: [
                    {type: 'max', name: '最大值'},
                    {type: 'min', name: '最小值'}
                ]
            },
            markLine: {
                data: [{type: 'average', name: '平均值'}]
            }
        },
        {
            name: '最低气温',
            type: 'line',
            data: [1, -2, 2, 5, 3, 2, 0],
            markPoint: {
                data: [{name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}]
            },
            markLine: {
                data: [
                    {type: 'average', name: '平均值'},
                    [
                        {
                            symbol: 'none',
                            x: '90%',
                            yAxis: 'max'
                        },
                        {
                            symbol: 'circle',
                            label: {
                                position: 'start',
                                formatter: '最大值'
                            },
                            type: 'max',
                            name: '最高点'
                        }
                    ]
                ]
            }
        }
    ]
}

// 组件
<Echart>
    <Title text="未来一周气温变化" subtext="纯属虚构" />
    <Tooltip trigger="axis" />
    <Legend data={['最高气温', '最低气温']} />
    <Toolbox show={true}>
        <Feature 
            dataView={{readOnly: false}}
            magicType={{type: ['line', 'bar']}} 
            restore={{}}
        >
            <DataZoom yAxisIndex="none" />
            <SaveAsImage />
        </Feature>
    </Toolbox>
    <XAxis 
        type="category" 
        boundaryGap={false} 
        data={['周一', '周二', '周三', '周四', '周五', '周六', '周日']} 
    />
    <YAxis type="value">
        <AxisLabel formatter="{value} °C" />
    </YAxis>
    <Series 
        name="最高气温" 
        type="line" 
        data={[10, 11, 13, 11, 12, 12, 9]}
    >
        <MarkPoint
            data={[
                {type: 'max', name: '最大值'}, 
                {type: 'min', name: '最小值'}
            ]}
        />
        <MarkLine 
            data={[
                {type: 'average', name: '平均值'}
            ]} />
    </Series>
    <Series 
        name="最低气温" 
        type="line" 
        data={[1, -2, 2, 5, 3, 2, 0]}
    >
        <MarkPoint 
            data={[
                {name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}
            ]}/>
        <MarkLine
            data={[
                {type: 'average', name: '平均值'},
                [
                    {
                        symbol: 'none', 
                        x: '90%', 
                        yAxis: 'max'
                    },
                    {
                        symbol: 'circle', 
                        label: {
                            position: 'start', formatter: '最大值'
                        }, 
                        type: 'max', 
                        name: '最高点'
                    },
                ]
            ]}
        />
    </Series>
</Echart>

Echart 样式属性

themeName -- 主题色 string类型 详见Theme枚举值

width -- 宽

height -- 高

background 背景色

更多属性查看 https://www.echartsjs.com/option.html

LICENSE

MIT @MrSandManSy