个人作业二

热词云

 <script type="text/javascript">
    var Mychart = echarts.init(document.getElementById("main"));
var index = 0;
 <c:forEach items="${pres}" var="goods">
        arr[index++] = ${goods.confirmed};
    </c:forEach>    
var data1 = [
         <c:forEach items="${pres}" var="g">
                    ["${g.name}"],
                    </c:forEach>
    ]
    var option = {
             title: {
                    text: '热词分析',
                    left: 'center',
                    top: 20,
                    textStyle: {
                        color: '#ccc'
                    }
                },
            series:[{
                type:'wordCloud',

                //网格尺寸,尺寸越大,字体之间的间隔越大
                grideSize:2,

                //字体的最大与最小字号
                sizeRange:[12,35],
                
                //字体旋转的范围
                rotationRange:[45,90,135,-90],
                
                //词云形状 circle:圆形,pentagon:五边形
                //cardioid:苹果形或心形,star:星形,diamond:钻石,
                //triangle-forward:三角形,triangle:三角形,smooth:平滑
                shape:'circle',
                textStyle:{
                    normal:{
                        //字体随机颜色
                        color:function(){
                            return 'rgb('+[
                                Math.round(Math.random()*255),
                                Math.round(Math.random()*255),
                                Math.round(Math.random()*255)
                            ].join(',')+')';
                        }
                    },
                    emphasis:{
                        //阴影距离
                        shadowBlur:1,
                        //阴影颜色
                        shadowColor:'#aaff00'
                    }
                },
                data:data1
            }]
        };
    Mychart.setOption(option);
</script>

 

posted @ 2021-06-14 21:01  谦寻  阅读(22)  评论(0编辑  收藏  举报