echarts changes the circle in the tooltip of the histogram to a square type (custom histogram prompt box)

echarts changes the circle in the tooltip of the histogram to a square type (custom histogram prompt box)

renderings

insert image description here

the code

tooltip: {
            trigger: 'axis',
            // backgroundColor: 'gray',
            axisPointer: { // 坐标轴指示器,坐标轴触发有效,
              type: 'shadow', // 默认为line,line直线,cross十字准星,shadow阴影
              crossStyle: {
                color: '#fff'
              }
            },
            // 自定义提示框内容
            formatter: (data) => {
              console.log('parma', data)
              let str = '<div style="color:#0C1B52;font-size: 15px;font-weight: bold;margin-bottom: 5px;">' + data[0].axisValue + '</br></div>'
              data.reverse().forEach(item => {
                str = str + '<div style="font-size: 12px;padding: 4px 0">' + '<div style="display:inline-block;margin-right:4px;width:10px;height:10px;background-color:' + item.color + ';"></div>' + item.seriesName + ' : ' + item.data + '</br></div>'
              })
              return str
            },
            textStyle: {
              fontSize: 14
            }
          },

Guess you like

Origin blog.csdn.net/qq_44035882/article/details/129254756