echarts示例分享-自定义折线图的图标与最大最小值图标

在这里插入图片描述
下方代码可直接运行在https://echarts.apache.org/examples/zh/editor.html?c=line-simple

option = {
  tooltip: {
    trigger: 'axis'
  },
  title: {
    top: 10,
    left: 30,
    text: '{name|年增长率:} {value|' + 10 + '} {unit|%}',
    textStyle: {
      rich: {
        name: {
          fontSize: 14,
          fontWeight: 'bold',
          color: '#15b0b2'
        },
        value: {
          fontSize: 14,
          fontWeight: 'bold',
          color: 'black'
        },
        unit: {
          fontSize: 12,
          color: '#a2a2a2'
        }
      }
    }
  },
  legend: {
    top: 10,
    x: 'right',
    borderRadius: 5,
    itemWidth: 15,
    itemHeight: 15
  },
  grid: {
    top: 60,
    right: 15,
    left: 10,
    bottom: 1,
    containLabel: true
  },
  xAxis: {
    type: 'category',
    axisTick: {
      show: false
    },
    axisLine: {
      show: true,
      lineStyle: {
        color: '#e2e2e2'
      }
    },
    axisLabel: {
      color: 'black',
      lineHeight: 30
    },
    axisPointer: {
      type: 'shadow'
    },
    splitLine: {
      show: true,
      lineStyle: {
        type: 'dashed',
        color: '#e0e0e0'
      }
    },
    splitArea: {
      show: false,
      areaStyle: {
        color: ['#ffffff', '#fafafa']
      }
    },
    data: [1, 2, 3]
  },
  yAxis: [
    {
      type: 'value',
      axisLine: {
        show: true,
        lineStyle: {
          color: '#e2e2e2'
        }
      },
      axisLabel: {
        color: 'black'
      },
      splitLine: {
        show: true,
        lineStyle: {
          type: 'dashed'
        }
      },
      splitArea: {
        show: true
      }
    },
    {
      type: 'value',
      splitLine: {
        show: false
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#e2e2e2'
        }
      },
      axisLabel: {
        color: 'black',
        formatter: '{value}%'
      }
    }
  ],
  series: [
    {
      label: {
        color: '#15B7B8',
        show: true,
        position: 'top',
        fontWeight: 'bold'
      },
      name: '年度',
      type: 'bar',
      barWidth: 15,
      data: [10, 20, 30, 40],
      itemStyle: {
        borderRadius: [10, 10, 0, 0],
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: '#2ECFD1' // 0%处的颜色
            },
            {
              offset: 1,
              color: '#13B4B7' // 100%处的颜色
            }
          ]
        }
      }
    },
    {
      name: '增长率',
      type: 'line',
      lineStyle: {
        type: 'dashed',
        color: '#F1BF68'
      },
      itemStyle: {
        color: '#F1BF68',
        borderColor: '#fff',
        borderWidth: 2,
        shadowColor: '#F1BF68',
        shadowBlur: 10
      },
      symbol: 'circle',
      symbolSize: 10,
      yAxisIndex: 1,
      data: [10, 20, 100],
      markPoint: {
        symbol:
          'image://' +
          'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAAAjCAMAAAD1/jdcAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAALFQTFRFAAAA661F661F661F661F661F661F661F661F661F661F661F661F661F7bNR8Lxi8b5m8b9n661F661F661F8b5l661F661F661F661F8b5m8b9m7bNR661F7LFM661F661F661F7bRS8b5m8L1k7LBK661F661F661F661F661F661F7rVT8L1k7LBL661F661F661F661F7rZV8L1k7LFN661F661F661F661F661FvQ/oBwAAADt0Uk5TAAIHDBIVFgQcLTk/QSNbzvb/Bg0s7jgRPhT391obTSJDS3/45mVJQgMXHTFz5FUrARAoZNJHDhkeCwVXmKGrAAAA40lEQVR4nO3WxxKCMBAG4IWlg8QgRQTE3nvX938wE73KOJN48MB/znzZ0/4LAIqKmm6IRddQVYDFRMt2XE8srmNbaLJJsOGTJhVNk/gNVEC1fHHj5fhWAC2bSCGUkhBBc+RGoTSKE9BdSYTSdgqGJ614Rq3USq3Uyp8rP9iYbsq2d0cS4dv7N03CWi2TQrK8CHjD5iQSNiLSLVnD8rYP449t3+sPhuzhaDyZVrZ9HBY440eDElRcHvPFcpXR9WZbVF8eCQavy6M6O3N/OJ7O5fsz4ezMy/Vm3OUQxswe6uPLxDxPYLiMPmJuVccAAAAASUVORK5CYII',
        symbolSize: [65, 31],
        symbolOffset: [0, -22],
        label: {
          color: '#fff'
        },
        data: [
          { type: 'max', name: 'Max' },
          { type: 'min', name: 'Min' }
        ]
      }
    }
  ]
};

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值