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

ec-wordcloud

v0.0.3

Published

echarts-like wordcloud component

Downloads

20

Readme

ec-wordcloud

文档

Install

<script src="ec-wordcloud.js"></script>
<script>
<!--ECWordcloud变为全局变量-->
</script>

Or

npm install ec-wordcloud -S
/** 或者推荐 **/
yarn add ec-wordcloud -S
import ECWordcloud from 'ec-wordcloud'

Usage

options更多请参考wordcloud2

const wordcloud = new ECWordcloud(document.querySelector('.wordcloud'));

wordcloud.setOption({
    // ...
    maskImage: 'https://example.com/images/shape.png',     // 提供一张图片(链接方式,仅支持jpg/png),根据其形状进行词云渲染
    fontSizeFactor: 0.1,                                    // 词云权重系数,默认为0.1
    maxFontSize: 60,                                        // 最大fontSize,用来控制weightFactor,默认60
    minFontSize: 12,                                        // 最小fontSize,用来控制weightFactor,默认12
    tooltip: {
        show: true,                                         // 默认:false
        backgroundColor: 'rgba(0, 0, 0, 0.701961)',         // 默认:'rgba(0, 0, 0, 0.701961)'
        formatter: function(item) {                         // 数据格式化函数,item为list的一项
        }
    },
    data:[{
        name:'测试1',value:11
    },{
        name:'测试2',value:11
    }]
    // ...其余请参考wordcloud2.js
});

methods

resize

wordcloud.resize()

Notice

更好地支持图片形状,注意点:

  • 请使用图形为纯黑色的白底图片(格式为jpg/png);
  • 如果形状显示不太完美,请不断调整fontSizeFactor, maxFontSize和minFontSize等参数;
  • 其他格式(SVG、base64等)暂不支持,请先转换为图片;