• echarts中将title设置成图片


    echart饼图没有数据时候,把标题暂无数据替换成图片

     this.myCharts.setOption({
                    title: {
                        show: !this.flag,   // 没数据才显示
                        extStyle: {
                            color: "gainsboro",
                            fontSize: 20
                        },
                        text: "{A|}",
                        left: "center",
                        top: "center",
                        textStyle: {
                            rich: {
                                A: {
                                    //添加背景图片并且设置宽高,会自适应显示
                                    140,
                                    height:140,
                                    backgroundColor: {
                                        image: require("../../assets/common/ic-empty-data.png")
                                    }
                                }
                            }
                        }
                    },
                    tooltip: {
                        trigger: 'item',
                        formatter: '{a} <br/>{b}: {c} ({d}%)'
                    },
                    legend: {
                        // orient: 'vertical',
                        icon: "rect",
                        itemWidth: 10,
                        itemHeight: 10,
                        right: '1%',
                        top: '-1%',
                        itemGap: 12,  
                         textStyle: {
                            color: '#666666',
                        },
                        data: this.legenData
                    },
                    color : [ '#397ae5', '#fc7070', '#75c17b', '#d222e2' ],
                    series: [
                        {
                            name: '分布图',
                            type: 'pie',
                            radius: ['35%', '65%'],
                            center: ['50%', '58%'],
                            avoidLabelOverlap: false,
                            label: {
                                normal: {
                                    formatter: a => {
                                        return (a.data['value'] + '(' + a.data['prtio'] + ')')
                                    },
                                    show: true,
                                    position: 'left',
                                    color: '#999999'
                                },
                            },
                            labelLine: {
                                normal: {
                                    show: true,
                                    lineStyle: {
                                        color: '#999999'
                                    },
                                }
                            },
                            data: this.chartData
                        }
                    ],
                })
    

      

  • 相关阅读:
    shell 时间循环
    t
    IntelliJ IDEA For Mac 快捷键
    JVM的默认参数
    qt不同模块使用多语言
    cocos2dx 实现gpu instancing
    so so.*.*
    Android开发-解决 AIDL 中找不到couldn't find import for class错误
    Android Watchdog源码简析--Based on Android 6.0.1
    View绘制流程--Based on kitkat
  • 原文地址:https://www.cnblogs.com/theblogs/p/16438070.html
Copyright © 2020-2023  润新知