Echarts漏斗图 金字塔图 样式修改

Echarts漏斗图 金字塔图 样式修改

效果图

在这里插入图片描述

<template>
    <div id="main" style="height: 400px;"  ref="myChart"></div>
</template>
<script>
    export default {
        data() {
            return {}
        },
        methods:{
            loadOption11Echart() {
                this.myCharts = echarts.init(this.$refs.myChart);
                this.option11 = {
                    tooltip: {
                            trigger: 'item',
                            formatter:function(params){
                                return `${params.marker}\n${params.data.name}${params.data.num}`
                            }
                        },
                        legend: {
                            data: ['上市企业','专精特新企业','高新技术企业','注册企业总数'],
                            orient: 'vertical',
                            left: 'left',
                            top:'center',
                        },

                        series: [
                            {
                                name:'',
                                type:'funnel',
                                left: '10%',
                                top: 60,
                                bottom: 60,
                                width: '80%',
                                min: 0,
                                max: 100,
                                minSize: '0%',
                                maxSize: '100%',
                                sort: 'ascending',
                                label: {
                                    // 图形右侧数据
                                    formatter:function(params){
                                        if(params.data.name == '注册企业总数') {
                                            return `{a|${params.data.num}家}`
                                        }else {
                                            return `{b|${params.data.num}家}\n{c|占比${params.data.ratio}}`
                                        }
                                    },
                                    rich:{
                                        a: {
                                            color: '#000',
                                            lineHeight: 10,
                                            fontweight:"bold",
                                            fontSize:16
                                        },
                                        b: {
                                            color: '#000',
                                            lineHeight: 30,
                                            fontweight:"bold",
                                            fontSize:16
                                        },
                                        c: {
                                            color: '#b1b3b8',
                                            lineHeight: 20,
                                            fontSize:12,
                                            padding:[10,0]
                                        }
                                    },

         
                                },
                                labelLine: {
                                    show: false
                                },
                                itemStyle: {
                                    borderColor: "#fff",
                                    borderWidth: 1,
                                },
                                emphasis: {
                                    label: {
                                        label: {
                                        position: 'inside',
                                        // formatter: '{b}Expected: {c}%'
                                        }
                                    }
                                },
                                data:this.echartsOjb

                            },
                            {
                                name: '',
                                type: 'funnel',
                                left: '10%',
                                width: '80%',
                                maxSize: '80%',
                                sort: 'ascending',
                                label: {
                                    position: 'inside',
                                    show: true,
                                    color: '#fff'
                                },
                                itemStyle: {
                                    opacity: 1,
                                    borderColor: '#fff',
                                    borderWidth: 2
                                },
                                emphasis: {
                                    label: {
                                        fontSize: 16
                                    }
                                },
                                data:this.echartsOjb,
                                z: 100
                            }
                        ]
                };
                this.myCharts.setOption(this.option11);
            } 
        }
    }
</script>
  • 8
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值