echarts 参考样式

export const barConfig = barData => {
  let option = {
    tooltip: {
      backgroundColor: "rgba(27, 126, 242, 0.8)",
      borderColor: "rgba(27, 126, 242, 0.8)",
      textStyle: {
        color: "#fff"
      },
      axisPointer: {
        type: "shadow"
      },
      trigger: "axis"
    },
    legend: {
      icon: "circle",
      top: "4%",
      textStyle: {
        color: "#fff"
      }
    },
    grid: {
      left: "20",
      right: "20",
      bottom: "3%",
      containLabel: true
    },
    xAxis: [
      {
        type: "category",
        data: barData.time,
        axisLabel: {
          formatter: function(val) {
            let num = Number(val.substr(0, 2)) % 2;
            if (num == 0) {
              return val;
            } else {
              return "";
            }
          },
          interval: 0,
          textStyle: {
            //改变xy轴上文字的颜色
            color: "#fff"
          }
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: "#25318c"
          }
        }
      }
    ],
    yAxis: {
      name: barData.unit,
      nameTextStyle: {
        color: "#fff",
        fontSize: 13,
        padding: [0, 0, 0, -50]
      },
      splitLine: {
        show: true,
        lineStyle: {
          color: "#25318c"
        }
      },
      axisLabel: {
        textStyle: {
          //改变xy轴上文字的颜色
          color: "#fff"
        }
      }
    },
    series: [
      {
        name: "尖",
        type: "bar",
        stack: "Ad",
        color: "#ea3c53",
        emphasis: {
          focus: "series"
        },
        data: barData.epj
      },
      {
        name: "峰",
        type: "bar",
        stack: "Ad",
        color: "#eaa23c",
        emphasis: {
          focus: "series"
        },
        data: barData.epf
      },
      {
        name: "平",
        type: "bar",
        stack: "Ad",
        color: "#4db560",
        emphasis: {
          focus: "series"
        },
        data: barData.epp
      },
      {
        name: "谷",
        type: "bar",
        stack: "Ad",
        color: "#339eee",
        emphasis: {
          focus: "series"
        },
        data: barData.epg
      }
    ]
  };
  return option;
};

export const gaugeConfig = gaugeData => {
  let option = {
    series: [
      {
        type: "gauge",
        radius: "110%",
        center: ["50%", "55%"],
        axisLine: {
          lineStyle: {
            width: 10,
            color: [
              [0.3, "#4db560"],
              [0.7, "#eaa23d"],
              [1, "#ea3c52"]
            ]
          }
        },
        pointer: {
          itemStyle: {
            color: "#fff"
          }
        },
        axisTick: {
          distance: -10,
          length: 4,
          lineStyle: {
            color: "#fff",
            width: 2
          }
        },
        splitLine: {
          distance: -10,
          length: 10,
          lineStyle: {
            color: "#fff",
            width: 3
          }
        },
        axisLabel: {
          color: "#fff",
          distance: 15,
          fontSize: 14,
          formatter: function(val) {
            return val != 0 && val != 100 ? val : "";
          }
        },
        detail: {
          valueAnimation: true,
          formatter: "{value} % \n 实时负荷率",
          color: "#fff",
          fontSize: 18
        },
        data: [
          {
            value: gaugeData.sumLoadRaTe,
            detail: {
              offsetCenter: [0, "55%"]
            }
          }
        ]
      }
    ]
  };
  return option;
};

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值