zoukankan      html  css  js  c++  java
  • ehcarts-折线图-基本

    效果图:

      <div style=" 462px; height: 180px" id="energyLeftTop"></div>
     // 自适应字体大小变化
        WidthAdaptive(res) {
          var windth = window.innerWidth;
          let fontSize = windth / 1920;
          return fontSize * res;
        },
        drawLine() {
          // 基于准备好的dom,初始化echarts实例
          let myChart = this.$echarts.init(
            document.getElementById("energyLeftTop")
          );
    
          let option = {
            backgroundColor: "transparent",
            color: ["#FFDD01"],
    
            grid: {
              left: "5%",
              right: "5%",
              top: "20%",
              bottom: "5%",
              containLabel: true,
            },
            xAxis: {
              axisTick: { show: false },
              axisLabel: {
                textStyle: { color: "#CCCCCC", fontSize: 14 },
              },
              axisLine: {
                // onZero: false, // X轴脱离Y轴0刻度
                lineStyle: { color: "#cccccc", type: "solid" },
              },
    
              data: ["08/02", "08/03", "08/04", "08/05", "08/06", "08/07", "08/08"],
            },
            yAxis: {
              name: "单位(t)",
              nameTextStyle: {
                color: "#CCCCCC",
                fontSize: this.WidthAdaptive(12),
              },
              axisTick: { show: false },
              axisLabel: {
                textStyle: { color: "#CCCCCC", fontSize: this.WidthAdaptive(12) },
              },
              axisLine: {
                lineStyle: { color: "#cccccc", type: "solid" },
              },
              splitLine: {
                lineStyle: {
                  type: "dashed",
                  color: "rgba(135,140,147,0.2)",
                },
              },
              boundaryGap: [0, 0.1],
            },
            series: [
              {
                name: "地面",
                type: "line",
                symbolSize: this.WidthAdaptive(6),
                data: [61, 35, 96, 169, 54, 69, 34],
              },
            ],
          };
          window.onresize = function () {
            myChart.resize();
          };
          myChart.setOption(option);
        },
  • 相关阅读:
    python多线程多进程
    python单元测试unittest
    python学习笔记(一):python简介和入门
    今天的收获!!!
    Python django
    React router
    30分钟掌握ES6/ES2015核心内容
    webpack+React.js
    我喜欢的两个js类实现方式 现在再加上一个 极简主义法
    js实现的笛卡尔乘积-商品发布
  • 原文地址:https://www.cnblogs.com/a973692898/p/15384526.html
Copyright © 2011-2022 走看看