4.4.4 • Published 10 months ago

chartjs-chart-wordcloud v4.4.4

Weekly downloads
85
License
MIT
Repository
github
Last release
10 months ago

Chart.js Word Clouds

NPM Package Github Actions

Chart.js module for charting word or tag clouds. Adding new chart type: wordCloud.

Works only with Chart.js >= 3.0.0-alpha.2

word cloud example

Install

npm install --save chart.js@next chartjs-chart-wordcloud@next

Usage

see Samples on Github

or at this Open in CodePen

Word Cloud

Data Structure

const config = {
  type: 'wordCloud',
  data: {
    // text
    labels: ['Hello', 'world', 'normally', 'you', 'want', 'more', 'words', 'than', 'this'],
    datasets: [
      {
        label: 'DS',
        // size in pixel
        data: [90, 80, 70, 60, 50, 40, 30, 20, 10],
      },
    ],
  },
  options: {},
};

Styling of elements

A word has the basic FontSpec styling options (family, color, ...). In addition it has several options regarding rotating the text.

Controller options:

https://github.com/sgratzl/chartjs-chart-wordcloud/blob/14ac8327c2209c0d8f89fdd6cd86d2b2d7daedce/src/controllers/WordCloudController.ts#L184-L193

Word element options:

https://github.com/sgratzl/chartjs-chart-wordcloud/blob/14ac8327c2209c0d8f89fdd6cd86d2b2d7daedce/src/elements/WordElement.ts#L3-L29

ESM and Tree Shaking

The ESM build of the library supports tree shaking thus having no side effects. As a consequence the chart.js library won't be automatically manipulated nor new controllers automatically registered. One has to manually import and register them.

Variant A:

import { Chart } from 'chart.js';
import { WordCloudController, WordElement } from 'chartjs-chart-wordcloud';

Chart.register(WordCloudController, WordElement);
...

new Chart(ctx, {
  type: WordCloudController.id,
  data: [...],
});

Variant B:

import { WordCloudChart } from 'chartjs-chart-wordcloud';

new WordCloudChart(ctx, {
  data: [...],
});

Development Environment

npm i -g yarn
yarn set version 2
cat .yarnrc_patch.yml >> .yarnrc.yml
yarn
yarn pnpify --sdk vscode

Common commands

yarn compile
yarn test
yarn lint
yarn fix
yarn build
yarn docs
yarn release
yarn release:pre
4.4.4

10 months ago

4.4.3

11 months ago

4.4.2

11 months ago

4.4.1

1 year ago

4.4.0

1 year ago

4.3.3

2 years ago

4.3.2

2 years ago

4.2.3

2 years ago

4.3.1

2 years ago

4.2.4

2 years ago

4.3.0

2 years ago

4.2.2

2 years ago

4.2.1

2 years ago

4.2.0

2 years ago

4.1.0

3 years ago

4.0.0

3 years ago

4.1.1

3 years ago

3.10.0

3 years ago

4.0.0-alpha

3 years ago

3.9.1

3 years ago

3.9.0

3 years ago

3.8.0

3 years ago

3.7.1

3 years ago

3.7.0

4 years ago

3.6.0

4 years ago

3.5.0

4 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

3.0.0-rc.3

4 years ago

3.0.0-beta.11

5 years ago

3.0.0-beta.9

5 years ago

3.0.0-beta.7

5 years ago

3.0.0-beta.6

5 years ago

3.0.0-beta.4

5 years ago

3.0.0-beta.3

5 years ago

3.0.0-beta.1

5 years ago

3.0.0-alpha.20

5 years ago