echarts的多个折现数据出现坐标和值对不上的问题以及设置最小刻度的问题。...

  1. 当出现多个折现数据,echarts可以配置stack值使用堆积值还是单个值

图片描述

option = {
        noDataLoadingOption: {
          text: '暂无数据',
          effect: 'bubble',
          effectOption: {effect: {n: 0}}, textStyle: {fontSize: 24}
        },
        symbolList: ['circle'],
        tooltip: {
          trigger: 'axis', textStyle: {align: 'left'},
          axisPointer: {lineStyle: {color: '#E3E3E3', width: 1, type: 'solid'},}
        },
        // grid: {x: '60px', x2: '60px', borderWidth: 0},
        legend: {data: ['最大响应时长', '平均响应时长', '最小响应时长']},
        toolbox: {show: true},
        // calculable: true,
        xAxis: [{
            type: 'category',
            boundaryGap: false,
            data: ['00:00-02:00', '02:00-04:00', '04:00-06:00', '06:00-08:00', '08:00-10:00', '10:00-12:00'],
            splitLine: {lineStyle: {width: 0}},
            axisLabel: {interval: 0,/*横轴信息全部显示*/   rotate: 20,/*20度角倾斜显示*/}
          }],
        yAxis: [{
            type: 'value',
            axisLine: {lineStyle: {color: '#333', width: 0, type: 'solid'}},
            splitLine: {lineStyle: {color: '#e3e3e3', width: 1, type: 'dashed'}},
          }],
        series: [
          {
            name: '最大响应时长',
            smooth: true,
            type: 'line',
            stack: '总量', // 重要的点 这个参数会使用堆积值作为纵坐标的刻量值。
            data:[........],
            itemStyle: {normal: {color: '#D06E17', lineStyle: {width: 1, color: '#D06E17'}}}
          },{
            name: '平均响应时长',
            smooth: true,
            type: 'line',
            stack: '总量', // 重要的点 这个参数会使用堆积值作为纵坐标的刻量值。
            data:[........],
            itemStyle: {normal: {color: '#C35AD9', lineStyle: {width: 1, color: '#C35AD9'}}}
          },{
            name: '最小响应时长',
            smooth: true,
            type: 'line',
            stack: '总量', // 重要的点 这个参数会使用堆积值作为纵坐标的刻量值。
            data:[........],
            itemStyle: {normal: {color: '#1FD5CE', lineStyle: {width: 1, color: '#1FD5CE'}}}
          },
      ]
  • 去掉stack值后

图片描述

 option3 = {
        noDataLoadingOption: {
          text: '暂无数据',
          effect: 'bubble',
          effectOption: {effect: {n: 0}}, textStyle: {fontSize: 24}
        },
        symbolList: ['circle'],
        tooltip: {
          trigger: 'axis', textStyle: {align: 'left'},
          axisPointer: {lineStyle: {color: '#E3E3E3', width: 1, type: 'solid'},}
        },
        // grid: {x: '60px', x2: '60px', borderWidth: 0},
        legend: {data: ['最大响应时长', '平均响应时长', '最小响应时长']},
        toolbox: {show: true},
        // calculable: true,
        xAxis: [{
            type: 'category',
            boundaryGap: false,
            data: ['00:00-02:00', '02:00-04:00', '04:00-06:00', '06:00-08:00', '08:00-10:00', '10:00-12:00'],
            splitLine: {lineStyle: {width: 0}},
            axisLabel: {interval: 0,/*横轴信息全部显示*/   rotate: 20,/*20度角倾斜显示*/}
          }],
        yAxis: [{
            type: 'value',
            axisLine: {lineStyle: {color: '#333', width: 0, type: 'solid'}},
            splitLine: {lineStyle: {color: '#e3e3e3', width: 1, type: 'dashed'}},
          }],
        series: [
          {
            name: '最大响应时长',
            smooth: true,
            type: 'line',
            // stack: '总量',  // 去除stack这个参数
            itemStyle: {normal: {color: '#D06E17', lineStyle: {width: 1, color: '#D06E17'}}}
          },{
            name: '平均响应时长',
            smooth: true,
            type: 'line',
            // stack: '总量',  // 去除stack这个参数
            itemStyle: {normal: {color: '#C35AD9', lineStyle: {width: 1, color: '#C35AD9'}}}
          },{
            name: '最小响应时长',
            smooth: true,
            type: 'line',
            // stack: '总量', // 去除stack这个参数
            itemStyle: {normal: {color: '#1FD5CE', lineStyle: {width: 1, color: '#1FD5CE'}}}
          },
      ]
  };
echarts纵坐标的最小刻度设置问题
配置项: yAxis.minInterval

关联文章:https://echarts.baidu.com/opt...
图片描述

 yAxis: [{
        type: 'value', //只有在type设置为value或者time中有效。
        minInterval: 1, //最小刻度设置项
        name: '单位:笔',
        axisLabel: {formatter: '{value}'},
        axisLine: {lineStyle: {color: '#333', width: 0, type: 'solid'}},
        splitLine: {lineStyle: {color: '#e3e3e3', width: 1, type: 'dashed'}}
      }],
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值