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...
圖片描述html

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'}}
      }],
相關文章
相關標籤/搜索