longyvfengyun
2023-11-17 14738594692929f696eab3b2726547659506baf7
src/components/echarts/options/gradientLine.js
@@ -1,5 +1,10 @@
import * as echarts from 'echarts';
const getGradientLineOption = ()=> {
const getGradientLineOption = (data)=> {
  const defaultOption = {
    minRatio: 0,
    maxRatio: 1.2
  };
  const option = {...defaultOption, ...data};
  return {
    tooltip: {
      trigger: "item",
@@ -17,46 +22,52 @@
    xAxis: {
      type: 'category',
      boundaryGap: true,
      axisLine: { //坐标轴轴线相关设置。数学上的x轴
        show: true,
      axisLine: {
        lineStyle: {
          color: '#f9f9f9'
        },
          color: 'rgba(255,255,255,0.12)'
        }
      },
      axisLabel: { //坐标轴刻度标签的相关设置
      axisLabel: {
        margin: 10,
        color: '#e2e9ff',
        textStyle: {
          color: '#d1e6eb',
          margin: 15,
          fontSize: 14
        },
      },
      axisTick: {
        show: false,
      },
    },
    yAxis: {
      type: 'value',
      min: 0,
      splitLine: {
        show: true,
        lineStyle: {
          color: '#0a3256'
      min(data) {
        const min =data.min;
        if(isNaN(min)) {
          return 0;
        }else {
          return (min * option.minRatio).toHold(0);
        }
      },
      max(data) {
        const max = data.max;
        if(isNaN(max)) {
          return 1;
        }else {
          return (max * option.maxRatio).toHold(0);
        }
      },
      axisLabel: {
        formatter: '{value}',
        color: '#e2e9ff',
      },
      axisLine: {
        show: true,
        lineStyle: {
          color: '#f9f9f9'
        },
          color: 'rgba(255,255,255,0.12)'
        }
      },
      axisLabel: {
        margin: 20,
        textStyle: {
          color: '#d1e6eb',
        },
      },
      axisTick: {
        show: false,
      },
      splitLine: {
        lineStyle: {
          color: 'rgba(255,255,255,0.12)'
        }
      }
    },
    series: [
      {