@antv/f2-wordcloud
TypeScript icon, indicating that this package has built-in type declarations

5.4.5 • Public • Published

F2 的 词云图

基于第三方库 wordcloud2 的扩展

Usage

const data = [{
  word: 'series',
  weight: 274470,
}, ...].sort((a, b) => {
  return b.weight - a.weight;
});

const img = await new Promise((resolve) => {
  const img = new Image();
  img.src = 'https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/3fd5a3b2-a7d0-4c51-aede-c2c8bbaac8b8.png';

  img.onload = () => {
    resolve(img);
  }
});

<Canvas context={context}>
  <WordCloud
    data={data}
    maskShape={
      <group>
        <image
          style={{
            x: 0,
            y: 0,
            // img 需要先 load 完成
            img,
            width: 260,
            height: 200,
          }}
        />
      </group>
    }
  />
</Canvas>;

Package Sidebar

Install

npm i @antv/f2-wordcloud

Weekly Downloads

2

Version

5.4.5

License

MIT

Unpacked Size

66.2 kB

Total Files

14

Last publish

Collaborators

  • xuying1027
  • lvisei
  • yisi.wang
  • basketduck
  • biupiubiupiu
  • flash1
  • dreammy23
  • laixingui.lxg
  • zhangjunjie-loki
  • rainy25ghz
  • zeyuwang
  • yanxiong
  • susiwen8
  • freestyle21
  • soundquiet
  • elaine.q.10
  • sturuby
  • sakuya223
  • serializedowen
  • xdzhao
  • yangzhanmei
  • wjgogogo
  • leungwensen
  • dori
  • iaaron
  • yard
  • simaq
  • dxq613
  • intchous
  • susan_ann
  • jinke.li
  • lzxue
  • army8735
  • atool
  • baizn
  • dengfuping
  • neoddish
  • jeffy2012
  • zqlu
  • afc163
  • pomelo-nwu
  • kopiluwaky
  • ccnuzindex
  • panyuqi
  • bubkoo
  • zengyue
  • kasmine
  • boyu.zlj
  • l1ud0ngq1
  • newbyvector
  • winniexing
  • chenluli
  • kn9117
  • xdddst
  • semious2020
  • esora
  • nadia_liu
  • bbsqq
  • mxz96102
  • openwayne
  • pearmini
  • pddpd
  • yiqianyao
  • zhanba
  • cxxxxxn