V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
christin
V2EX  ›  问与答

请教一个 echarts 中的问题

  •  
  •   christin · 2021-08-06 17:24:34 +08:00 via iPhone · 520 次点击
    这是一个创建于 1151 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如图

    图片
    这是我用 guage 仪表盘做的环形图,现在的问题是 tooltip 死活出不来,各种地方都设置了就是无效 。有大佬能指点一下吗?
    附上 option

    
    option: {
            tooltip: {
              trigger: "item",
              show: true,
              triggerOn: "mousemove",
              alwaysShowContent: true,
              formatter: function (params) {
                console.log(params);
                return "123";
              },
            },
            series: [
              {
                type: "gauge",
                startAngle: 90,
                endAngle: -270,
                radius: "95%",
                min: 0,
                max: 1206.88, //全国
                pointer: {
                  show: false,
                },
                itemStyle: {
                  color: "rgb(223, 149, 10)",
                },
                progress: {
                  show: true,
                  overlap: false,
                  clip: false,
                  itemStyle: {
                    borderWidth: 4,
                    borderColor: "rgb(223, 149, 10)",
                  },
                },
                axisLine: {
                  lineStyle: {
                    width: 5, //宽度
                    color: [[1, "rgb(25, 61, 144)"]],
                  },
                },
                splitLine: {
                  show: false,
                  distance: 0,
                  length: 10,
                },
                axisTick: {
                  show: false,
                },
                axisLabel: {
                  show: false,
                  distance: 50,
                },
                data: [
                  {
                    value: 20,
                    name: "全国占比",
                    title: {
                      offsetCenter: ["0%", "20%"],
                      color: "rgb(207, 147, 25)",
                    },
                    detail: {
                      offsetCenter: ["0%", "-20%"], //1206.88 947.12
                      color: "white",
                    },
                  },
                ],
                title: {
                  fontSize: 12,
                },
                detail: {
                  // 	width: 50,
                  // 	height: 14,
                  fontSize: 14,
                  // 	color: "auto",
                  // 	borderColor: "auto",
                  // 	borderRadius: 20,
                  // 	borderWidth: 1,
                  // 	formatter: "{value}%",
                },
                tooltip: {
                  formatter: function (params) {
                    console.log(params);
                    return "123";
                  },
                },
              },
            ],
          },
    
    
    christin
        1
    christin  
    OP
       2021-08-12 10:00:24 +08:00 via iPhone
    更新解决方案
    仪表盘的 tooltip 是在指针上的,需要鼠标移动到指针上才能出现。但是我之前写的指针不显示,所以无法出现。可以修改 pointer 的 show 为 true 然后再设置颜色为透明 即可使用 tooltip 了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2094 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:34 · PVG 23:34 · LAX 08:34 · JFK 11:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.