echarts-wordcloud
Third-party Wordcloud extension based on wordcloud2.js for Apache ECharts.

Examples
Google Trends
ECharts Option Keywords
Install
<script src="echarts.min.js"></script>
<script src="echarts-wordcloud.min.js"></script>
Or
npm install echarts
npm install echarts-wordcloud
import * as echarts from 'echarts';
import 'echarts-wordcloud';
⚠️ NOTE:
echarts-wordcloud@2 is for echarts@5
echarts-wordcloud@1 is for echarts@4
Usage
var chart = echarts.init(document.getElementById('main'));
chart.setOption({
...
series: [{
type: 'wordCloud',
shape: 'circle',
keepAspect: false,
maskImage: maskImage,
left: 'center',
top: 'center',
width: '70%',
height: '80%',
right: null,
bottom: null,
sizeRange: [12, 60],
rotationRange: [-90, 90],
rotationStep: 45,
gridSize: 8,
drawOutOfBound: false,
shrinkToFit: false,
layoutAnimation: true,
textStyle: {
fontFamily: 'sans-serif',
fontWeight: 'bold',
color: function () {
return 'rgb(' + [
Math.round(Math.random() * 160),
Math.round(Math.random() * 160),
Math.round(Math.random() * 160)
].join(',') + ')';
}
},
emphasis: {
focus: 'self',
textStyle: {
textShadowBlur: 10,
textShadowColor: '#333'
}
},
data: [{
name: 'Farrah Abraham',
value: 366,
textStyle: {
}
}]
}]
});
Changelog
2.1.0
- [chore] Update Apache ECharts version
- [chore] Sync with the latest wordcloud2.js and use prettier to format the code
- [feature] Add
keepAspect option to keep aspect ratio of maskImage or 1:1 for shapes
- [feature] Add
drawOutOfBound option to allow words to be drawn partly outside of the canvas
- [feature] Add
shrinkToFit option to shrink the text if the font size is too large for the text to be displayed
Notice
The Apache Software Foundation Apache ECharts, ECharts, Apache, the Apache feather, and the Apache ECharts project logo are either registered trademarks or trademarks of the Apache Software Foundation.
评论