Highcharts Moneytrack word cloud
author(s): Pavlo
by Pavlo
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/wordcloud.js"></script>
<div id="container"></div>
CSS
#container {
max-width: 800px;
margin: 0 auto;
height:600px;
}
JavaScript
var text = 'MoneyTrack MoneyTrack MoneyTrack MoneyTrack MoneyTrack money currencies tracking reports accounts banks cards money currencies tracking reports accounts banks cards EUR AUD USD budgets transactions categories online synchronization security offline income expences charts revenue notifications all-in-one rates categories multiple_accounts sharing savings savings transfer coin calculate pay bills bills planning purchases purchases credit load buy cards assets fees fees import export export import_wizard formats transactions operations notes costs costs payments payments records debt profit investing cash cash spending exchange transfer';
var lines = text.split(/[,\. ]+/g),
data = Highcharts.reduce(lines, function (arr, word) {
var obj = Highcharts.find(arr, function (obj) {
return obj.name === word;
});
if (obj) {
obj.weight += 1;
} else {
obj = {
name: word.replace(/_/g, ' '),
weight: 1
};
arr.push(obj);
}
return arr;
}, []);
Highcharts.chart('container', {
height: 800,
series: [{
type: 'wordcloud',
data: data,
name: 'Occurrences'
}],
title: {
text: 'Wordcloud of MoneyTrack'
}
});