<div id="getWordCloud" style="height: 200px; width: 100%"></div>
<script>
require("echarts-wordcloud");
import echarts from "echarts";
export default {
methods: {
getWordCloud() {
let myChart = echarts.init(
document.getElementById("getWordCloud"),
"macarons"
);
myChart.setOption({
tooltip: {},
series: [
{
type: "wordCloud", //类型为字符云
shape: "smooth", //平滑 circle
gridSize: 8, //网格尺寸
rotationRange: 90, //旋转范围
textStyle: {
normal: {
fontFamily: "", // 字体
color: function () {
return (
"rgb(" +
Math.round(Math.random() * 255) +
", " +
Math.round(Math.random() * 255) +
", " +
Math.round(Math.random() * 255) +
")"
);
},
},
emphasis: {
shadowBlur: 5, //阴影距离
shadowColor: "#333", //阴影颜色
},
},
left: "center",
top: "center",
right: null,
bottom: null,
width: "100%",
height: "100%",
data: [], // 数据
},
],
});
},
},
};
</script>
vue+echarts实现wordcloud
最新推荐文章于 2024-06-22 10:45:00 发布
关键词由CSDN通过智能技术生成