介绍

根据自己定义Echarts词云图背景图,词云图可方便的对词组进行可视化的显示。

效果图

        

一 安装

        npm install echarts-wordcloud

        注意Echarts5.0的版本要对应echarts-wordcloud的2.0版本,注意Echarts4.0的版本要对应echarts-wordcloud的1.0版本。

二 使用

        1. 引入

                import "echarts-wordcloud/dist/echarts-wordcloud";

        2. 代码实现

                

// 初始化echarts
        initEcharts(arr) {
            let symbolUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqMAAAHGCAYAAABAToIcAAAgAElEQVR4nO3dPW9kR7of8OLLkDN3BncAB74rwgQcONt0VzIGBhz4E/gzGA6cXNzEXkvARAQ4K222ieHMn8FfwBmB0d272UZObBCgdp1R4Ozwpck2zqqO5qj3dPfp7vNSdc7vBzQkUTNkd3Xz9L+fqnoqAAA/cRJCeBm/cBZvAADQi8d4m8V/Xht26M6+sQWAH91W/n0v/rOokl4aIujGnnEFgB/Nlrw3FhXSI8ME7VMZBYD1Phoj6IYwCgCfPC0Zi9/uOEbFJqj7ylrUOxujAABYdF/ZwFS9FV+/2GK0zlZ8z+L2sOX3hdGwZhQAPikqlocrxuNgydeLHfcv4r+Xs46bvMfOYzB9UflasWnq1HPD2JmmB4BPbleMxbzmaxdx2v1VDKoHMYRuWuzZixukqi2lTmI4hlETRgFge593MMtY/X6Hlel8a0wZJdP0APBJUen8Ysl4LLZ3+jhAu6ebEMLrnn8mdEoYBYCfelwyHuXX9wd+/9TzlFExTQ8APzVbMh7VNaFDOoj30alQjIIwCkAKLuJmnRTWRn6TxpCstBc3ON0nfB8BgAm7ruzKfljYJX4Z/38qG2IeFnpvzja4b2fx77cZymYr+oKmeLPjnqxZMwowPsvOV78KIfxsyaxY2bboqef1iA8r7s+7EMLbha8XIfp5COE4BtBq38+rlvpyLhu/lC3rfwrJM00PMC4XK4LUyYrrftkb8yAGvj78w5r782W8L9dx53rZz7Nsd7QYwE5aqvbW9RNNneoo2VIZBRiXdScINTFv4Xu8iAFynS6qkEVQ/bqmqtrEskpt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7IAiiHRNGASBNb2vObC/D5azh5pkUTjXK5WSleWVj0q4HCrABYRQA0vUm9pScx96UHzYIoiFuaioD1p8GepQpHDVapxzTg3gr+4AejawBf/KsGQUAuvIsBuhVLaeGku2JRWOjtRMA0IUiiP6zWJ1N0R886wkIIfx/yJXSet9ps8sAAAAASUVORK5CYII=';
            let myChart = this.$echarts.init(document.getElementById('cytEcharts'));
            let data = [];
            for(let i in arr) {
                let item = arr[i];
                data.push({
                    name: item.jg || item.nation,
                    value: item.perNum
                })
            }
            const colorList = [
                '#3a96f5',
                '#5faaf7',
                '#78bafe',
                '#1563f2',
                '#add2f8',
                '#e24bf4',
                '#1acaff',
                '#ffde00',
                '#89fda5'
            ];
            var maskImage = new Image();
            maskImage.src = symbolUrl;
            let option = {
                // backgroundColor: '#0A2E5D',
                tooltip: {
                    show: true
                },
                grid: {
                    left: 0,
                    bottom: 0,
                    top: 0,
                    right: 0,
                },
                xAxis: {
                    type: "category",
                    show: false
                },
                yAxis: {
                    max: 100,
                    show: false
                },
                series: [{
                        zlevel: -1,
                        type: 'pictorialBar',
                        name: 'pictorial',
                        silent: true,
                        symbol: 'image://' + symbolUrl, //按背景渲染云词
                        symbolSize: ['95.2%', '100%'],
                        symbolPosition: 'center',
                        barWidth: '100%',
                        barMaxWidth: '100%',
                        itemStyle: {
                            normal: {
                                opacity: 0 //自己项目中这里可以设置0全透明,然后可以写一个div背景加载一个美化过的云图片,重合放在这个图表下面。
                            }
                        },
                        data: [{
                            value: 100
                        }]
                    },
                    {
                        type: 'wordCloud',
                        sizeRange: [12, 42],
                        rotationRange: [0, 0],
                        maskImage: maskImage,
                        textPadding: 0,
                        gridSize: 10, //用于标记画布可用性的网格大小(以像素为单位)//字距越大,字距越大。
                        width: '95%',
                        height: '99.8%',
                        left: 'center',
                        top: 'center',
                        drawOutOfBound: false,
                        textStyle: {
                            normal: {
                                fontFamily: "sans-serif",
                                color: function() {
                                    let index = Math.floor(Math.random() * colorList.length);
                                    return colorList[index];
                                }
                            }
                        },
                        data: data
                    },
                ]
            }

            myChart.setOption(option);
            this.myChart = myChart;
            setTimeout(() => {
                window.addEventListener("resize", () => myChart.resize());
            }, 200);
        },

        

        3. 注意点

                a. 背景图必须是黑色的 这个只是限制文字的显示位置

                        

         b. 背景色可以不显示

                

itemStyle: {
      normal: {
             opacity: 0 //自己项目中这里可以设置0全透明,然后可以写一个div背景加载一个美化过的云图片,重合放在这个图表下面。
      }
},

        

        c. 加上自己的图片 设置背景就行

                

<div 
   class="fxypContent"
   v-loading="jzrsffxLoading"
   element-loading-text="拼命加载中"
   element-loading-spinner="el-icon-loading"
   element-loading-background="rgba(0, 0, 0, 0.8)"
>
   <div class="echartsbox">
       <div id="cytEcharts" style="width: 100%; height: 100%;"></div>
   </div>
</div>


<style scoped>
.echartsbox {
    width: 100%;
    height: 100%;
    background: url('../../../../assets/img/jzrsffx.png') no-repeat center center;
    background-size: 90% 90%;
}

</style>

                

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐