function colud(doap){ chart = echarts.init(document.getElementById('helloword')); var maskImage = new Image(); maskImage.src = './logo.png'; var option = { tooltip: {}, series: [ { type: 'wordCloud', gridSize: 0, sizeRange: [10,25], rotationRange: [-80, 80], shape: 'pentagon', drawOutOfBound: false, textStyle: { color: function () { return 'rgb(' + [ Math.round(Math.random() * 160), Math.round(Math.random() * 160), Math.round(Math.random() * 160) ].join(',') + ')'; } }, emphasis: { show:true, textStyle:{ fontSize:30, fontWeight:'bold' } }, data:doap } ] }; option.series[0].maskImage; chart.setOption(option); chart.on('click', function (params) { //点击事件 var str_p = params.data.name; var str_v = params.data.value; console.log(str_p); bench(ids); ids.push(str_p); rench(str_p); var sp = document.getElementById(str_p).parentNode.parentNode; sp.scrollTop = 1800; kewords("iccvtable",str_p); kewords("eccvtable",str_p); kewords("cvrptable",str_p); changetitle(); }); }
最后的效果大概是这种感觉: