柱状图结合折线图

option: {
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              // 坐标轴指示器,坐标轴触发有效
              type: 'none', // 默认为直线,可选为:'line' | 'shadow'
            },
            confine: true,
            backgroundColor: 'rgba(255, 255, 255, 0.94)',
            borderWidth: 1,
            borderColor: '#F4F4F4',
            borderRadius: 6,
            boxShadow: '0px 2px 4px rgba(207, 149, 104, 1)',
            padding: 10,
            textStyle: {
              color: '#333',
            },
            formatter: (params) => {
              let str = `<p>${params[0].name}</p>
                        <p><span>${params[2].marker}得分:</span>${params[2].value}</p>
                        <p><span>${params[0].marker}加分:</span>+${params[0].value}</p>
                        <p><span>${params[1].marker}减分:</span>-${params[1].value}</p>`
              return str
            },
          },
          legend: {
            top: 16,
            right: 0,
            itemWidth: 14,
            itemHeight: 8,
            itemGap: 12,
          },
          grid: {
            left: 0,
            right: 0,
            top: 60,
            bottom: 16,
            // 是否显示刻度标签 如果是true 就显示 否则反之
            containLabel: true,
          },
          xAxis: {
            type: 'category',
            data: [],
            axisTick: {
              show: false, //不显示坐标轴刻度
            },
            axisLine: {
              show: false, //不显示坐标轴轴线
            },
            // 坐标轴文字样式
            axisLabel: {
              interval: 0,
              fontSize: 12,
              fontFamily: 'Microsoft YaHei',
            },
          },
          yAxis: [
            {
              type: 'value',
              axisLabel: {
                show: false, //不显示刻度标签
              },
              axisTick: {
                show: false, //不显示坐标轴刻度
              },
              axisLine: {
                show: false, //不显示坐标轴轴线
              },
              splitLine: {
                lineStyle: {
                  // 分隔线颜色,可以设置成单个颜色。
                  // 也可以设置成颜色数组,分隔线会按数组中颜色的顺序依次循环设置颜色。
                  color: '#F4F4F4',
                },
              },
            },
            {
              type: 'value',
              axisLabel: {
                show: false, //不显示刻度标签
              },
              axisTick: {
                show: false, //不显示坐标轴刻度
              },
              axisLine: {
                show: false, //不显示坐标轴轴线
              },
              splitLine: {
                lineStyle: {
                  // 分隔线颜色,可以设置成单个颜色。
                  // 也可以设置成颜色数组,分隔线会按数组中颜色的顺序依次循环设置颜色。
                  color: '#F4F4F4',
                },
              },
            },
          ],
          series: [
            {
              name: '',
              type: 'bar',
              data: [],
              barWidth: 14,
              itemStyle: {
                color: this.$eachrtColor.green,
              },
              label: {
                show: true,
                position: 'inside',
                color: '#333',
                formatter: (params) => {
                  return '+' + params.value
                },
              },
            },
            {
              name: '',
              type: 'bar',
              data: [],
              barWidth: 14,
              barGap: '15%',
              itemStyle: {
                color: this.$eachrtColor.red,
              },
              label: {
                show: true,
                position: 'inside',
                color: '#333',
                formatter: (params) => {
                  return '-' + params.value
                },
              },
            },
            {
              name: '',
              type: 'line',
              yAxisIndex: 1,
              data: [],
              // 拐点样式
              symbol: 'circle',
              symbolSize: 8,
              itemStyle: {
                color: this.$eachrtColor.blue,
                borderColor: '#fff',
                borderWidth: 2,
              },
              // 折线颜色
              lineStyle: {
                width: 2,
                color: this.$eachrtColor.blue,
              },
              label: {
                show: true,
                position: 'top',
                fontSize: 10,
                color: this.$eachrtColor.blue,
                formatter: (params) => {
                  return '第' + this.echartData[params.dataIndex].level + '名'
                },
              },
            },
          ],
        },

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值