wed前端数据可视化

以下是开源代码。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>数据可视化</title>
    <link rel="stylesheet" href="css/index.css" />
  </head>
  <body>
    <!-- 头部 -->
    <header>
      <h1>数据可视化-ECharts</h1>
      <div class="show-time"></div>
      <script>
        var t = null;
        t = setTimeout(time, 1000); //开始运行
        function time() {
          clearTimeout(t); //清除定时器
          dt = new Date();
          var y = dt.getFullYear();
          var mt = dt.getMonth() + 1;
          var day = dt.getDate();
          var h = dt.getHours(); //获取时
          var m = dt.getMinutes(); //获取分
          var s = dt.getSeconds(); //获取秒
          document.querySelector(".show-time").innerHTML =
            "当前时间:" +
            y +
            "年" +
            mt +
            "月" +
            day +
            "日-" +
            h +
            "时" +
            m +
            "分" +
            s +
            "秒";
          t = setTimeout(time, 1000); //设定定时器,循环运行
        }
      </script>
    </header>

    <!-- 页面主体 -->
    <section class="mainbox">
      <!-- 左侧盒子 -->
      <div class="column">
        <div class="panel bar">
          <h2>柱形图-就业行业</h2>
          <!-- 图表放置盒子 -->
          <div class="chart"></div>
          <!-- 伪元素绘制盒子下边角 -->
          <div class="panel-footer"></div>
        </div>
        <div class="panel line">
          <h2>折线图-人员变化
            <a class="a-active" href="javascript:;">2020</a>
            <a href="javascript:;">2021</a>
          </h2>
          <div class="chart"></div>
          <div class="panel-footer"></div>
        </div>
        <div class="panel pie">
          <h2>饼形图-年龄分布</h2>
          <div class="chart"></div>
          <div class="panel-footer"></div>
        </div>
      </div>
      <!-- 中间盒子 -->
      <div class="column">
        <!-- 头部 no模块 -->
        <div class="no">
          <div class="no-hd">
            <ul>
              <li>12434</li>
              <li>10983</li>
            </ul>
          </div>
          <div class="no-bd">
            <ul>
              <li>前端需求人数</li>
              <li>市场供应人数</li>
            </ul>
          </div>
        </div>
        <!-- map模块 -->
        <div class="map">
          <div class="map1"></div>
          <div class="map2"></div>
          <div class="map3"></div>
          <div class="chart"></div>
        </div>
      </div>
      <!-- 右侧盒子 -->
      <div class="column">
        <div class="panel bar2">
          <h2>柱形图-就业行业</h2>
          <div class="chart"></div>
          <div class="panel-footer"></div>
        </div>
        <div class="panel line2">
          <h2>折线图-播放量</h2>
          <div class="chart"></div>
          <div class="panel-footer"></div>
        </div>
        <div class="panel pie2">
          <h2>饼形图-地区分布</h2>
          <div class="chart"></div>
          <div class="panel-footer"></div>
        </div>
      </div>
    </section>

    <script src="js/flexible.js"></script>
    <script src="js/echarts.min.js"></script>
    <script src="js/jquery.js"></script>
    <!-- 引入china.js 完成地图模块 -->
    <script src="js/china.js"></script>
    <script src="js/index.js"></script>
  </body>
</html>
// css 初始化

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  // overflow: hidden;
}

li {
  list-style: none;
}

// 声明字体
@font-face {
  font-family: electronicFont;
  src: url(../font/DS-DIGIT.TTF);
}


body {
  background: url(../images//bg.jpg) no-repeat top center;
  line-height: 1.15;
}

header {
  position: relative;
  height: 1.25rem;
  background: url(../images/head_bg.png) no-repeat;
  background-size: 100% 100%;

  h1 {
    font-size: .475rem;
    color: rgba(255, 255, 255, 0.87);
    text-align: center;
    line-height: 1rem;
  }

  .show-time {
    position: absolute;
    top: 0;
    right: .375rem;
    line-height: .9375rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: .25rem;
  }
}

// 页面主体盒子
.mainbox {
  display: flex;
  min-width: 1024px;
  max-height: 1920px;
  margin: 0 auto;
  padding: .125rem .125rem 0;

  .column {
    flex: 3;
  }

  .column:nth-child(2) {
    flex: 5;
    margin: 0 .125rem .1875rem;
    // 图片旋转有时会超出屏幕最大位置导致滚动条自动上下移动
    overflow: hidden;
  }

  .panel {
    position: relative;
    height: 3.875rem;
    padding: 0 .1875rem .5rem;
    margin-bottom: .1875rem;
    border: 1px solid rgba(25, 186, 139, 0.17);
    background: url(../images/line.png) rgba(255, 255, 255, 0.03);

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 10px;
      height: 10px;
      border-left: 2px solid #02a6b5;
      border-top: 2px solid #02a6b5;
      content: '';
    }

    &::after {
      position: absolute;
      top: 0;
      right: 0;
      width: 10px;
      height: 10px;
      border-right: 2px solid #02a6b5;
      border-top: 2px solid #02a6b5;
      content: '';
    }

    .panel-footer {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;

      &::before {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 10px;
        height: 10px;
        border-left: 2px solid #02a6b5;
        border-bottom: 2px solid #02a6b5;
        content: '';
      }

      &::after {
        position: absolute;
        bottom: 0;
        right: 0;
        width: 10px;
        height: 10px;
        border-right: 2px solid #02a6b5;
        border-bottom: 2px solid #02a6b5;
        content: '';
      }
    }

    h2 {
      height: .6rem;
      color: #fff;
      line-height: .6rem;
      text-align: center;
      font-size: 0.25rem;
      font-weight: 400;
      a {
        color: rgb(167, 167, 167);
        text-decoration: none;
        margin: 0 .125rem;
      }
      .a-active {
        color: #fff;
      }
    }

    .chart {
      height: 3rem;
    }
  }
}

// no数字模块
.no {
  background-color: rgba(101, 132, 226, 0.1);
  padding: .1875rem;

  .no-hd {
    position: relative;
    border: 1px solid rgba(25, 186, 139, 0.17);

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: .375rem;
      height: .125rem;
      border-top: 2px solid #02a6b5;
      border-left: 2px solid #02a6b5;
      content: '';
    }

    &::after {
      position: absolute;
      bottom: 0;
      right: 0;
      width: .375rem;
      height: .125rem;
      border-bottom: 2px solid #02a6b5;
      border-right: 2px solid #02a6b5;
      content: '';
    }

    ul {
      display: flex;

      li {
        position: relative;
        flex: 1;
        line-height: 1rem;
        font-size: .875rem;
        color: #ffeb7b;
        text-align: center;
        font-family: electronicFont;

        &:first-child::after {
          content: '';
          position: absolute;
          top: 25%;
          right: 0;
          height: 50%;
          width: 1px;
          background-color: rgba(255, 255, 255, 0.3);
        }
      }
    }
  }

  .no-bd {
    ul {
      display: flex;

      li {
        flex: 1;
        text-align: center;
        color: rgba(255, 255, 255, 0.7);
        font-size: .225rem;
        height: .5rem;
        line-height: .5rem;
        padding-top: .125rem;
      }
    }
  }
}

.map {
  position: relative;
  height: 10.125rem;

  .map1 {
    width: 6.475rem;
    height: 6.475rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: url(../images/map.png);
    background-size: 100% 100%;
    opacity: 0.3;
  }

  .map2 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8.0375rem;
    height: 8.0375rem;
    background: url(../images/lbx.png);
    background-size: 100% 100%;
    animation: rotate1 15s linear infinite;
    opacity: .6;
  }

  .map3 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 7.075rem;
    height: 7.075rem;
    background: url(../images/jt.png);
    background-size: 100% 100%;
    animation: rotate2 15s linear infinite;
  }

  .chart {
    position: absolute;
    top: 0;
    left: 0;
    height: 10.125rem;
    width: 100%;
  }

  @keyframes rotate1 {
    from {
      transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
      transform: translate(-50%, -50%) rotate(360deg);
    }
  }

  @keyframes rotate2 {
    from {
      transform: translate(-50%, -50%) rotate(360deg);
    }

    to {
      transform: translate(-50%, -50%) rotate(0deg);
    }
  }
}

/* 约束屏幕尺寸 */
@media screen and (max-width: 1024px) {
  html {
    font-size: 42px !important;
  }
}
@media screen and (min-width: 1920px) {
  html {
    font-size: 80px !important;
  }
}

以下是运行图

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值