Word cloud
author(s): Jon Arild Nygård
by Dongor7
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/wordcloud.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
Word clouds are used to visualize how often each word in a
text occurs. This example uses an excerpt from the popular
"Lorem Ipsum" text. Words that appear often will appear
larger.
</p>
</figure>
JavaScript
const data = [
{
entity: 'Word9',
weight: 0.3,
},
{
entity: 'Word10',
weight: 0.1,
},
{
entity: 'Word11',
weight: 0.2,
},
{
entity: 'Word13',
weight: 0.4,
},
]
Highcharts.chart('container', {
series: [{
type: 'wordcloud',
data: data.map(({ entity, weight }) => ({ name: entity, weight })),
name: 'Occurrences'
}],
});