echarts可视化大屏入门

效果图:

index.less:

//css 初始化
* {
    margin:0;
    padding:0;
    box-sizing:border-box;
}
.box{
    width:1rem;
    height:1rem;
    background-color:pink
}
li{
    list-style:none;//消除数字前的圆点
}
//声明字体
@font-face{
    font-family:electronicFONT;
    src:url(../font/DS-DIGIT-4.ttf);
}
body{
    background:url(../images/bg1.jpeg)
    no-repeat top center;
    line-height:1.15;
}
header{
    position:relative;
    height:1.25rem;
    background:url(../images/bg1.jpeg)
    no-repeat;
    background-size:100% 100%;
    h1{
        font-size:0.475rem;
        color:#fff;
        text-align:center;
    line-height:1rem;    }
    .showTime{
        position:absolute;
        right:0.375rem;
        top:0;
        line-height:0.9375rem;
        color:rgba(255,255,255,0.7);
font-size:0.25rem;

    }

}
//页面盒子
.mainbox{
    display:flex;//父亲
    min-width:1024px;
    max-width:1920px;
    margin: 0 auto;//居中对齐
    padding:0.125rem 0.125rem 0;//边距设置
    .column{
        flex:3;//分为三份

    }
    .column:nth-child(2){
        flex:5;//第二部分宽为5份
        margin:0 0.125rem 0.1875rem;
        overflow:hidden;//超出部分隐藏

    }
    .panel{
        position:relative;
        height:3.875rem;
        padding: 0 0.1875rem 0.5rem;
        border:1px solid rgba(25,186,139,0.17);//边框设置
        margin-bottom:0.1875rem;
 background:url(../images/line.jpg) rgba(255.255.255.0.5);
    &::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:0.6rem;
            text-align:center;
            font-size:0.25rem;
            font-weight:400;
            a{
                color:#fff;
                text-decoration:none;
                margin:0 0.125rem;
            }
        }
        .chart{
            height:3rem;
 
        }
    }

}
//no数字模块
.no{
    background:rgba(101,132,226,0.1);
    padding:0.1875rem;
.no-hd{
    position:relative;
    border:1px solid rgba(142, 165, 237, 0.1);
    &::before{
        position:absolute;
        top:0;
        left:0;
        content:"";
        width:30px;
        height: 10px;
        border-top:2px solid #02a6b5;
        border-left:2px solid #02a6b5;
    }
    &::after{
        position:absolute;
        bottom:0;
        right:0;
        content:"";
        width:30px;
        height: 10px;
        border-bottom:2px solid #02a6b5;
        border-right:2px solid #02a6b5;
    }
    ul{
        display:flex;
        li{
            position:relative;
            flex:1;
            line-height:80px;
            font-size:0.875rem;
            color:#ffeb7b;
            text-align:center;
            font-family:"electronicFont";
            &::after{
                content:"";//竖线设置
                position:absolute;
                top:25%;
                right:0;
                height:50%;
                width:1px;
                background:rgba(255, 255, 255, 0.2)

            }
        }
    }
}
.no-bd{
    ul{
        display:flex;
        li{
            flex:1;//各自占一份
        text-align:center;
        color:rgba(255,255,255,0.7);
        font-size:0.225rem;
        height:0.5rem;
        line-height:0.5rem;
        padding-top:0.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%;

        opacity:0.6;
        animation:rotatel 15s linear infinite;//动画类型,间隔,匀速,无限循环
    }
    .map3{
        position:absolute;
        top:50%;
        left: 50%;
        transform:translate(-50%,-50%);
        width:8.0375rem;
        height:8.0375rem;
        background:url(../images/jt.png);
        background-size:100% 100%;
        opacity:0.6;
        animation:rotate2 15s linear infinite;//动画类型,间隔,匀速,无限循环
    }
    .chart{
        position:absolute;
        top:0;
        left:0;
        width:100%;
        height:10.125rem;
    }
    @keyframes rotatel{
        form{
            transform:translate(-50%,-50%)
            rotate(0deg);
        }
        to{
            transform:translate(-50%,-50%)//位置
            rotate(360deg);
        }
    }
    @keyframes rotate2{
        form{
            transform:translate(-50%,-50%)
            rotate(0deg);
        }
        to{
            transform:translate(-50%,-50%)//位置
            rotate(-360deg);
        }
    }
}
//约束屏幕尺寸:1024-1920之间
@media screen and (max-width:1024px){
    html{
        font-size:42px !important;
    }
}
@media screen and (max-width:1920px){
    html{
        font-size:80px !important;
    }
}

index.html:

<!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>可视化展板</h1>
            <div class="showTime"></div>
            <script>//显示时间:格式:当前时间:2024年3月13日21时31分01秒
                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(".showTime").innerHTML=
                    "当前时间:"+
                    y+
                    "年"+
                    mt+
                    "月"+
                    day+
                    "-"+
                    h+
                    "时"+
                    m+
                    "分"+
                    s+
                    "秒";
                    t=setTime(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 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">
                <div class="no">
                    <div class="no-hd">
                        <ul>
                            <li>123456</li>
                            <li>100000</li>
                        </ul>
                    </div>
                    <div class="no-bd">
                        <ul>
                            <li>前端需求人数</li>
                            <li>市场供应人数</li>
                        </ul>
                    </div>
                </div>
                 <!--地图模块-->
                 <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-3.7.0.js"></script>
        //必须先引入
        <script src="js/china.js"></script>
        <script src="js/index.js"></script>
    </body>
</html>

 其他文件:

一开始没有发现有pink老师的笔记,到处找笔记走了很多弯路

pink老师笔记地址:https://gitee.com/xiaoqiang001/eckarts_open_class.git。

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值