引入echarts和词云组件(两个要分开引入)
<script src="https://cdn.jsdelivr.net/npm/echarts@5.1.2/dist/echarts.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/echarts-wordcloud@2.0.2/dist/echarts-wordcloud.min.js"></script>
新版本(这里是5.1.2版本)的echarts设置textStyle不需要写在normal里面了,也就是将对文本的设置直接写在textStyle里
旧版本:
textStyle: {
normal: {
color: function () {
return 'rgb(' +
Math.round(Math.random() * 255)+','+
Math.round(Math.random() * 255)+','+
Math.round(Math.random() * 255) + ')';
}
},
新版本:
textStyle: {
color: function () {
return 'rgb(' +
Math.round(Math.random() * 255) + ',' +
Math.round(Math.random() * 255) + ',' +
Math.round(Math.random() * 255) + ')';
},