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

echarts-helper

v1.0.5

Published

Echarts3 secondary encapsulation to support a unified data structure and encapsulates commonly used functions

Downloads

25

Readme

Echarts3 secondary encapsulation to support a unified data structure and encapsulates commonly used functions

Install

<script src="echarts.min.js"></script>
<script src="echarts-helper.min.js"></script>

Or

npm install echarts echarts-helper
var echarts = require('echarts');
var echartsHelper = require('echarts-helper');

Demo

https://hdpfe.github.io/echarts-helper/

Usage

//return an hchartsInstance(extends from echartsInstance)
var chart = echartsHelper.create({
    dom:document.getElementById('main'),
    data:{},               //{},[] or null, when null is set,not emptyTips will show.     
    type:'bar',
    resize:true,           //(Optional)Default true
    sort:'none',           //(Optional)Default none,['none','asc','desc']
    sortType:'auto',       //(Optional)Default auto identify,can be ['date','number','text','number-like']
    emptyTips:true,        //(Optional)Default true,show empty tips when data is empty;
    emptyText:'暂无数据',   //(Optional)empty tips
    theme:'dark',          //(Optional)Default null
    echartsOption:{}       //(Optional)Default {},will merge to the generate option
})

//use theme
echarts.registerTheme('dark',{})

//show loading
chart.showLoading();
var data = yield getData();
chart.setData(data);  //show data and auto hide the loading tips

//get echarts option
var option = echartsHelper.getOption({
    data:{},
    type:'bar'
})

Data Structure


var data = {
    "category":{
        "name":"性别",
        "data":["男","女"]
    },
    "series":[
        {
            "axisName":"评论数",
            "axisIndex":0,                 //(Optional)default 0
            "stack":null,                  //(Optional)Specifies the stack group
            "dataName":"最小值",
            "data":[11,21]
        },
        {
            "dataName":"最大值",
            "data":[110,210]
        },
        {
            "dataName":"平均",
            "data":[59,103]
        },
        {
            "axisName":"点赞数",
            "axisIndex":1,
            "dataName":"最小值",
            "data":[5,10]
        },
        {   
            "axisIndex":1,
            "dataName":"最大值",
            "data":[23,24]
        },
        {
            "axisIndex":1,
            "dataName":"平均",
            "data":[12,16]
        }
    ]
}

Support Chart Type

bar                    //柱状图
barStack               //堆积柱状图
barSameStack           //等高堆积柱状图
barHori                //条形图
barHoriStack           //堆积条形图
barHoriSameStack       //等高堆积条形图
line                   //折线图
lineArea               //面积图
lineStack              //堆积折线图
lineAreaStack          //堆积面积图
barLine                //柱线图(双y轴)
map                    //地域分布图,会自动识别是省份还是城市显示为分布图还是散点图
pie                    //饼图,嵌套饼图
circle                 //环形图
radar                  //雷达图