美文网首页
echarts 在鼠标事件聚焦的标题修改

echarts 在鼠标事件聚焦的标题修改

作者: 高坚果_ | 来源:发表于2022-05-11 16:56 被阅读0次

      let txtes = "<br><b>我也是加粗效果</b>"
      var option = {
        title: {
          text: '',
          left: 'center',
          subtext: "12312312312",
          bottom: '-1%',
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow',
          },
        },
        legend: {},
        grid: {
          left: '3%',
          right: '4%',
          bottom: '5%',
          containLabel: true,
        },
        xAxis: [
          {
            type: 'category',
            data: ["1", "2", "3", "4", "5"],
          },
        ],
        yAxis: [
          {
            type: 'value',
          },
        ],
        series: [{
          name: ["", "123123123", "123123123", "123123123", "123123123"],
          type: "bar",
          tooltip: {
            trigger: "item",
            formatter: `人数:{c}<br><br><b>来源渠道:</b><br><br>{b}${txtes}`
          },
          barWidth: "60%",
          data: [{
            name: "asdkjh",
            value: 56,
          }, {
            name: "asdkjh",
            value: 26,
          }, {
            name: "asdkjh",
            value: 219,
          }, {
            name: "asdkjh",
            value: 34,
          },]
        }]
      }
      option && getchart.setOption(option)
      //随着屏幕大小调节图表
      window.addEventListener('resize', () => {
        getchart.resize()
      })  ```

效果图


相关文章

网友评论

      本文标题:echarts 在鼠标事件聚焦的标题修改

      本文链接:https://www.haomeiwen.com/subject/hezdurtx.html