@echarts-x/custom-word-cloud

中文文档
1.0.1发布于 2026/01/12Apache-2.0TypeScriptESM + CJS零依赖近 30 天下载 5460

Apache ECharts 自定义单词 Cloud 系列

中文使用文档
文档目录7 节
  1. 使用量
  2. 浏览器环境
  3. UMD( 通用模块定义)
  4. 无害环境管理(ES模块)
  5. API 密码
  6. 序列.数据
  7. 序列。项目付费负荷

@ echarts- x/ 习惯字云

wordCloud 是一个自定义序列,用于 Apache ECharts (英语),通常用于显示文本数据,其中每个单词的大小表明其频率或重要性.

wordCloud

源代码

使用量

浏览器环境

对于浏览器的使用,使用自动注册版本,在加载时自动安装自定义序列:

<script src="./node_modules/echarts/dist/echarts.js"></script>
<script src="./node_modules/@echarts-x/custom-word-cloud/dist/word-cloud.auto.js"></script>
<script>
  // No need to call echarts.use(), automatically registered
  const chart = echarts.init(...);
  const option = {
    series: [{
      type: 'custom',
      renderItem: 'wordCloud',
      // ...
    }]
  }
  chart.setOption(option);
</script>

见 实例 更多细节.

UMD( 通用模块定义)

对于需要人工注册或使用AMD/CommonJS加载器的环境:

// CommonJS
const echarts = require('echarts');
const wordCloudInstaller = require('@echarts-x/custom-word-cloud');
echarts.use(wordCloudInstaller);
const chart = echarts.init(...);

const option = {
  series: [{
    type: 'custom',
    renderItem: 'wordCloud',
    // ...
  }]
}
chart.setOption(option);

见 实例 更多细节.

无害环境管理(ES模块)

对于现代模块捆绑器或本地ES模块环境:

npm install @echarts-x/custom-word-cloud
import * as echarts from 'echarts';
import wordCloudCustomSeriesInstaller from '@echarts-x/custom-word-cloud';

echarts.use(wordCloudCustomSeriesInstaller);
const chart = echarts.init(...);

const option = {
  series: [{
    type: 'custom',
    renderItem: 'wordCloud',
    // ...
  }]
}
chart.setOption(option);

见 实例 更多细节.

API 密码

序列.数据

该系列的数据是数组. 每个子阵列代表一个字及其重量.

const data = [
  ['Visual Studio Code', 1000],
  ['ECharts', 800],
  ['TypeScript', 600],
  // ...
];

序列。项目付费负荷

这个 itemPayload 是一个包含下列属性的对象:

财产类型默认说明
leftnumber | string0字云组件与容器左侧相距.
topnumber | string0字云组件与容器上方的相距.
rightnumber | string0字云组件与容器右侧相距.
bottomnumber | string0字云元件与容器下方相距.
gridSizenumber8网格的大小,以像素表示画布的可用性。 网格大小越大,字相差越大.
sizeRange[number, number][12, 60]绘图文本大小的大小范围 .
rotationRange[number, number][-90, 90]文本旋转范围.
rotationStepnumber45轮回的程度 步.
maskImageHTMLImageElement | HTMLCanvasElement取出"云"所取之形. 白像素会被忽略,而非白像素将被用作绘制文字的区域.
keepAspectbooleanfalse是否保持宽比 maskImage 或者说 1:1 其他形状.
shapestring'circle'取出"云"所取之形. 现有礼物是: circle (违约), cardioid, (中文(简体) ), diamond, (中文(简体) ), triangle-forward, (中文(简体) ), triangle, (中文(简体) ), pentagon,以及 star。 。 。 .
shrinkToFitbooleanfalse是否缩小文本以适应容器 .
drawOutOfBoundbooleanfalse是否允许将文本从容器中抽出 .

版本与发布记录

@echarts-x/custom-word-cloud 共发布 3 个版本,首次发布于 2026/01/12;过去 12 个月发布了 3 个版本。

版本发布日期距今
1.0.1latest2026/01/1210 个月前
1.0.02026/01/1210 个月前
1.0.0-beta.0beta2026/01/1210 个月前

关于 @echarts-x/custom-word-cloud 的常见问题

@echarts-x/custom-word-cloud 是什么?

Apache ECharts 自定义单词 Cloud 系列

如何安装 @echarts-x/custom-word-cloud?

在项目目录运行 npm install @echarts-x/custom-word-cloud,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:echarts(^6.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@echarts-x/custom-word-cloud 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@echarts-x/custom-word-cloud 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@echarts-x/custom-word-cloud 可以商用吗?

@echarts-x/custom-word-cloud 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@echarts-x/custom-word-cloud 的下载量有多少?

根据 npm 官方下载统计,@echarts-x/custom-word-cloud 在 2026/10/13 – 2026/11/11 这 30 天内被下载 5,460 次,日均约 182 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@echarts-x/custom-word-cloud 还在维护吗?

最新版本 1.0.1 发布于 2026/01/12(10 个月前);至今共发布 3 个版本,其中过去 12 个月发布了 3 个;首次发布于 2026/01/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。