需求:
boxplot 细节

  1. 悬停时不加阴影
  2. 盒子内填充颜色不透明度 75%;中位数描边 2px,其他边界线描边 1px

不做任何设置的echarts箱图的样子
image.png


直接上代码

series: [
    {
      name: 'boxplot',
      type: 'boxplot',
      datasetIndex: 1,
      itemStyle: {
        borderColor:'#5470c6',
        color: '#5470c6',
        opacity:0.75
      },
      emphasis: {
        itemStyle: {
          borderColor: '#5470c6',
          color: '#5470c6',
          borderWidth: 1,  //该配置项去除hover后的加粗
          shadowColor: 'rgba(0,0,0,0)',  //该配置项去除hover后的阴影
          opacity:0.75
        }
      },
      // emphasis:'disabled',   //若用该配置项,tooltip会一直存在
      // hoverAnimation: false,  //该配置项无效果
      // silent: true,  //该配置项加上之后没有tooltip
      animation: false
    },
    {
      name: 'outlier',
      type: 'scatter',
      datasetIndex: 2,
      itemStyle: {
        color: '#5470c6',
      },
    }
  ]

实现需求后的效果图如下:
image.png

PS:中位线线宽2px目前没有找到好的方案,若有方案,欢迎留言回复


2 声望2 粉丝