test

博客园 首页 新随笔 联系 订阅 管理
  109 随笔 :: 0 文章 :: 1 评论 :: 16万 阅读
复制代码
            let option = {
                color:['#FFD700','#00CED1','#32CD32','#1E90FF'],   //环形颜色
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b}: {c} ({d}%)'
                },
                graphic: [{
                    type: 'text',
                    top: '48%',
                    left: 'center',
                    style: {
                        text: '2888',
                        fontSize: '0.6rem cursive',
                        textAlign: 'center',
                        fill: '#13a7d1',
                    }
                },
                {
                    type: 'text',
                    top: '42%',
                    left: 'center',
                    style: {
                        text: "总计(人)",
                        fill: "#999",
                        fontSize: '0.22rem cursive',
                    }
                }],
                series: [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius: ['40%', '60%'],
                        label: {
                            formatter: ' {b|{b}:}{c|{c}}',
                            backgroundColor: '#eee',
                            //borderColor: '#aaa',
                            borderWidth: 1,
                            borderRadius: 20,
                            // shadowBlur:3,
                            // shadowOffsetX: 2,
                            // shadowOffsetY: 2,
                            // shadowColor: '#999',
                            padding: [10, 30],
                            rich: {
                                b: {
                                    fontSize: '0.22rem cursive',
                                    color: '#676767',
                                },
                                c: {
                                    fontSize: '0.22rem cursive',
                                    color: '#30B6A2',
                                }
                            }
                        },
                        data: [
                            { value: 335, name: 'A1' },
                            { value: 310, name: 'A2' },
                            { value: 234, name: 'A3' },
                            { value: 135, name: 'A4' },
                        ]
                    }
                ]
            };
复制代码

 

 

第二种

复制代码
const totalLabel="总计";
            const totalValue="123";
            let option = {
                devicePixelRatio: window.devicePixelRatio,
                legend: {
                  show: false
                },
                series: [
                  {
                    type: "pie",
                    radius: [10, 10],
                    silent: true,
                    label: {
                      normal: {
                        show: true,
                        position: "center",
                        formatter: () => {
                          return `{a|${totalLabel}}\n{p|}\n{b|${totalValue}}{pre|人}`;
                        },
                        rich: {
                          a: {
                            fontSize: 24,
                            color: "rgba(0,0,0,0.45)"
                          },
                          p: {
                            width: "100%",
                            height: "24"
                          },
                          b: {
                            fontSize: 48,
                            color: "rgba(0,0,0,0.85)"
                          },
                          pre: {
                            fontSize: 24,
                            color: "rgba(0,0,0,0.45)"
                          }
                        }
                      },
                      emphasis: {
                        show: false
                      }
                    },
                    data: [{ value: 0, name: "", selected: true }]
                  },
                  {
                    type: "pie",
                    radius: ["35%", "60%"],
                    label: {
                      formatter: `{b}\n {c}`,
                      fontSize: 22,
                      color: "rgba(0,0,0,.65)"
                    },
                    data: [
                        { value: 335, name: 'A1' },
                        { value: 310, name: 'A2' },
                        { value: 234, name: 'A3' },
                        { value: 135, name: 'A4' },
                    ]
                  }
                ],
                color: ["#1890FF", "#13C2C2", "#2FC25B", "#FACC14", "#F04864"]
              };
复制代码

 

圆环pc端 非es语法

复制代码
var option = {
                backgroundColor: "#FFF",
                series: [{
                    name: '来源',
                    type: 'pie',
                    radius: ['50%', '85%'],
                    avoidLabelOverlap: false,
                    hoverAnimation: false,
                    label: {
                        normal: {
                            show: false,
                            position: 'center',
                            formatter: '{b|{c}}{pre|%}',
                            rich: {
                                b: {
                                    fontSize: 12,
                                    color: "#17a2b8"
                                },
                                pre: {
                                    fontSize: 10,
                                    color: "#17a2b8"
                                }
                            }
                        }

                    },
                    data: [{
                        value: 12,
                        label: {
                            normal: {
                                show: true
                            }
                        }
                    },
                    {
                        value: 100 - 12,
                        name: ''
                    }
                    ]
                }]
            };
复制代码

 

posted on   testgogogo  阅读(1884)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话
点击右上角即可分享
微信分享提示