echarts报错,不知道为啥?可能是依赖的词云图的js版本不对吗?
(function() {
// 1. 实例化对象
var myChart = echarts.init(document.querySelector(".map .chart"));
// 2. 指定配置和数据
// 2. 指定配置和数据
var data = {
value: [{
"name": "花鸟市场",
"value": 1446
},
{
"name": "汽车",
"value": 928
}
],
image:"data:image/png;base6。。。。。。。C"
}
var maskImage = new Image();
maskImage.src = data.image
maskImage.onload = function(){
myChart.setOption( {
backgroundColor:'#fff',
tooltip: {
show: false
},
series: [{
type: 'wordCloud',
gridSize: 1,
sizeRange: [12, 55],
rotationRange: [-45, 0, 45, 90],
maskImage: maskImage,
textStyle: {
normal: {
color: function() {
return 'rgb(' +
Math.round(Math.random() * 255) +
', ' + Math.round(Math.random() * 255) +
', ' + Math.round(Math.random() * 255) + ')'
}
}
},
left: 'center',
top: 'center',
right: null,
bottom: null,
data: data.value
}]
})
}
// myChart.setOption(option);
window.addEventListener("resize", function() {
myChart.resize();
});
})();