longyvfengyun
2023-11-11 f9af1703cf856d8d824255025701fc76d5fc0e83
src/components/echarts/options/radiusBar.js
@@ -1,6 +1,17 @@
import * as echarts from "echarts";
const getRadiusBarOption = ()=>{
const getRadiusBarOption = (data)=>{
  const defaultOption = {
    minRatio: 0,
    maxRatio: 1.2,
    grid: {
      top: '15%',
      right: '3%',
      left: '8%',
      bottom: '12%'
    },
  };
  const option = {...defaultOption, ...data};
  return {
    tooltip: {
      trigger: 'axis',
@@ -8,15 +19,9 @@
        type: 'shadow'
      }
    },
    grid: {
      top: '15%',
      right: '3%',
      left: '10%',
      bottom: '12%'
    },
    grid: option.grid,
    xAxis: [{
      type: 'category',
      data: ['9.21', '9.22', '9.23', '9.24', '9.25', '9.26', '9.27'],
      axisLine: {
        lineStyle: {
          color: 'rgba(255,255,255,0.12)'
@@ -31,12 +36,31 @@
      },
    }],
    yAxis: [{
      min(data) {
        const min =data.min;
        if(isNaN(min)) {
          return 0;
        }else {
          return min * option.minRatio;
        }
      },
      max(data) {
        const max = data.max;
        if(isNaN(max)) {
          return 1;
        }else {
          return max * option.maxRatio;
        }
      },
      axisLabel: {
        formatter: '{value}',
        color: '#e2e9ff',
      },
      axisLine: {
        show: false
        show: true,
        lineStyle: {
          color: 'rgba(255,255,255,0.12)'
        }
      },
      splitLine: {
        lineStyle: {
@@ -46,7 +70,8 @@
    }],
    series: [{
      type: 'bar',
      data: [300, 450, 770, 203, 255, 188, 156],
      // data: [["2021",100]],
      data: [],
      barWidth: '20px',
      itemStyle: {
        normal: {