效果图
从上到下,依次是F11效果,客户管理系统开发定制和正常网页效果,客户管理系统开发定制以及小屏效果。客户管理系统开发定制都是同比例缩放的,客户管理系统开发定制布局不会混乱
聊一下
客户管理系统开发定制为了让大家直观的看到客户管理系统开发定制所有的代码,客户管理系统开发定制所以结构方法等就不分客户管理系统开发定制各个组件引入了,客户管理系统开发定制会很麻烦要找哪是哪,客户管理系统开发定制我直接把所有的图都写在了一个vue组件内。客户管理系统开发定制并配上注释,相信大家可以很容易找到哪里对应哪里区域
核心点
这里的核心点就是等比例缩放的屏幕适配方法。可以让你不需要大量使用百分比或者转换之类的方法去写屏幕自适应大小,而是可以用部分px直接写css定死,通过屏幕大小改变对应等比例缩放,达到屏幕适配效果
前置条件
下载dataV
npm install @jiaminghi/data-view
- 1
下载echarts
npm install echarts --save
- 1
下载elementul
npm i element-ui -S
- 1
下载china.json
由于数据比较大,我另一个帖子写了,就不重复了,直接去复制这个文件https://blog.csdn.net/seeeeeeeeeee/article/details/121495485
main.js引入
引入dataV
// 将自动注册所有组件为全局组件import dataV from '@jiaminghi/data-view'Vue.use(dataV)
- 1
- 2
- 3
引入elementul
import ElementUI from 'element-ui';import 'element-ui/lib/theme-chalk/index.css';Vue.use(ElementUI);
- 1
- 2
- 3
引入china.json
import geoJson from '@/utils/china.json'echarts.registerMap('china', geoJson);
- 1
- 2
引入echarts
import * as echarts from 'echarts'Vue.prototype.$echarts = echarts
- 1
- 2
第一步:创建等比例缩放函数 drawMixin.js
// 屏幕适配 mixin 函数// * 默认缩放值const scale = { width: '1', height: '1',}// * 设计稿尺寸(px)const baseWidth = 1920const baseHeight = 1080// * 需保持的比例(默认1.77778)const baseProportion = parseFloat((baseWidth / baseHeight).toFixed(5))export default { data() { return { // * 定时函数 drawTiming: null } }, mounted () { //进入触发 this.calcRate() window.addEventListener('resize', this.resize) }, beforeDestroy () { window.removeEventListener('resize', this.resize) }, methods: { calcRate () { //拿到整个页面元素 const appRef = this.$refs["appRef"] //如果没有值就结束 if (!appRef) return // 当前宽高比 const currentRate = parseFloat((window.innerWidth / window.innerHeight).toFixed(5)) //判断:如果有值代表页面变化了 if (appRef) { //判断当前宽高比例是否大于默认比例 if (currentRate > baseProportion) { // 如果大于代表更宽了,就是放大了 //那么把默认缩放的宽高改为:同比例放大 scale.width = ((window.innerHeight * baseProportion) / baseWidth).toFixed(5) scale.height = (window.innerHeight / baseHeight).toFixed(5) console.log(scale.width,scale.height,'放大'); //整个页面的元素样式,缩放宽高用当前同比例放大的宽高 appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)` } else { // 如果不大于默认比例代表缩小了。 //那么把默认缩放的宽高改为:同比例缩小 scale.height = ((window.innerWidth / baseProportion) / baseHeight).toFixed(5) scale.width = (window.innerWidth / baseWidth).toFixed(5) console.log(scale.width,scale.height,'缩小'); //整个页面的元素样式,缩放宽高用当前同比例放大的宽高 appRef.style.transform = `scale(${scale.width}, ${scale.height}) translate(-50%, -50%)` } } }, resize () { clearTimeout(this.drawTiming) this.drawTiming = setTimeout(() => { this.calcRate() }, 200) } },}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
第二步:创建用来给日期时间转换格式用的函数index.js
/** * @param {Function} fn 防抖函数 * @param {Number} delay 延迟时间 */export function debounce(fn, delay) { var timer; return function () { var context = this; var args = arguments; clearTimeout(timer); timer = setTimeout(function () { fn.apply(context, args); }, delay); };}/** * @param {date} time 需要转换的时间 * @param {String} fmt 需要转换的格式 如 yyyy-MM-dd、yyyy-MM-dd HH:mm:ss */export function formatTime(time, fmt) { if (!time) return '';//没传时间返回空 else { const date = new Date(time); const o = { 'M+': date.getMonth() + 1,//月 'd+': date.getDate(),//日 'H+': date.getHours(),//时 'm+': date.getMinutes(),//分 's+': date.getSeconds(),//秒 'q+': Math.floor((date.getMonth() + 3) / 3),//月+3/3 S: date.getMilliseconds(),//返回时间的毫秒 }; if (/(y+)/.test(fmt))//匹配1个到多个y //这一步把年转换完毕 fmt = fmt.replace( RegExp.$1,//拿到y+匹配到的第一个分组 (date.getFullYear() + '').substr(4 - RegExp.$1.length) ); //这一步把生下的格式继续匹配转换 for (const k in o) { if (new RegExp('(' + k + ')').test(fmt)) { fmt = fmt.replace( RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length) ); } } return fmt; }}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
第三步:大屏可视化代码
复制进去就行了
<template> <div id="index" ref="appRef"> <div class="bg"> <dv-loading v-show="loading">Loading...</dv-loading> <div class="host-body"> <div> <!-- 顶部title部分 --> <el-row> <el-col :span="6" ><dv-decoration-8 class="title_right" :color="['#008CFF', '#00ADDD']" /></el-col> <el-col :span="12" ><div class="title_text">数 据 可 视 化 系 统</div> <dv-decoration-5 class="title_center" :color="['#008CFF', '#00ADDD']" /></el-col> <el-col :span="6" ><div class="title_time">{{ dateYear + dateWeek + dateDay }}</div> <dv-decoration-8 :reverse="true" class="title_left" :color="['#008CFF', '#00ADDD']" /></el-col> </el-row> <!-- 主体部分 --> <el-row> <!-- 第一列 --> <el-col :span="6"> <!-- 饼图部分 --> <div class="left_box1"> <dv-border-box-12> <div id="Rose_diagram"></div> <dv-active-ring-chart :config="config" class="left_box1_rose_right" /> <div class="rose_text" v-for="(item, index) in numberData" :key="index" > <p> <span class="coin">¥</span> <span class="rose_text_nmb">{{ item.number.number }}</span> </p> <p> <span>{{ item.text }}</span> <span class="colorYellow">(件)</span> </p> </div> </dv-border-box-12> </div> <!-- 柱状图部分 --> <div class="left_box2"> <dv-border-box-12 style="padding-top: 10px"> <p style="margin-left: 15px">数据统计图</p> <div id="columnar"></div> </dv-border-box-12> </div> <!-- 轮播表格部分 --> <div class="left_box3"> <dv-border-box-12 style="padding-top: 10px"> <dv-scroll-board :config="board_info" class="carousel_list" oddRowBGC="#fff" /> </dv-border-box-12> </div> </el-col> <!-- 第二列 --> <el-col :span="12"> <!-- 中国地图 --> <div id="china-map"></div> <!-- 折线图 --> <div class="line_center"> <dv-border-box-8> <div id="line_center_diagram"></div> </dv-border-box-8> </div> </el-col> <!-- 第三列 --> <el-col :span="6"> <!-- 轮播排行榜部分 --> <div class="right_box1"> <dv-border-box-12> <dv-decoration-7 style="width: 100%; height: 30px" >销 售 排 行 榜</dv-decoration-7 > <dv-scroll-ranking-board :config="config" style="width: 95%; height: 87%; margin-left: 2%" /> </dv-border-box-12> </div> <!-- 虚线柱状图部分 --> <div class="right_box2"> <dv-border-box-12 :reverse="true"> <div id="dotter_bar"></div> </dv-border-box-12> </div> <!-- 部分 --> <div class="right_box3"> <dv-border-box-12 :reverse="true"> <dv-conical-column-chart :config="cone" class="cone_box" /> </dv-border-box-12> </div> </el-col> </el-row> </div> </div> </div> </div></template><script>import drawMixin from "../utils/drawMixin"; //自适应缩放import { formatTime } from "../utils/index.js"; //日期格式转换import * as echarts from "echarts";export default { mixins: [drawMixin], data() { return { //定时器 timing: null, //loading图 loading: true, //时分秒 dateDay: null, //年月日 dateYear: null, //周几 dateWeek: null, //周几 weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"], //轮播排行榜 config: { data: [ { name: "周口", value: 55, }, { name: "南阳", value: 120, }, { name: "西峡", value: 78, }, { name: "驻马店", value: 66, }, { name: "新乡", value: 80, }, { name: "信阳", value: 45, }, { name: "漯河", value: 29, }, ], }, //左侧饼图文字 numberData: [ { number: { number: 15, }, text: "今日构建总量", }, { number: { number: 1144, }, text: "总共完成数量", }, { number: { number: 361, }, text: "正在编译数量", }, ], //左侧轮播表格配置项 board_info: { header: ["人员", "月产量", "月合格率"], data: [ ["张三", "10830", "90%"], ["张四", "13500", "92%"], ["张五", "10350", "97%"], ["张六", "13300", "94%"], ["张七", "12500", "95%"], ["张八", "11500", "96%"], ["张九", "12500", "89%"], ["王六", "10360", "95%"], ["王二", "10567", "91%"], ["李四", "15721", "99%"], ], evenRowBGC: "#020308", oddRowBGC: "#382B47", headerBGC: "#020308", }, // 定义颜色 colorList: { linearYtoG: { type: "linear", x: 0, y: 0, x2: 1, y2: 1, colorStops: [ { offset: 0, color: "#f5b44d", }, { offset: 1, color: "#28f8de", }, ], }, linearGtoB: { type: "linear", x: 0, y: 0, x2: 1, y2: 0, colorStops: [ { offset: 0, color: "#43dfa2", }, { offset: 1, color: "#28f8de", }, ], }, linearBtoG: { type: "linear", x: 0, y: 0, x2: 1, y2: 0, colorStops: [ { offset: 0, color: "#1c98e8", }, { offset: 1, color: "#28f8de", }, ], }, areaBtoG: { type: "linear", x: 0, y: 0, x2: 0, y2: 1, colorStops: [ { offset: 0, color: "rgba(35,184,210,.2)", }, { offset: 1, color: "rgba(35,184,210,0)", }, ], }, }, //锥形柱状图 cone: { data: [ { name: "周口", value: 55, }, { name: "南阳", value: 120, }, { name: "西峡", value: 71, }, { name: "驻马店", value: 66, }, { name: "新乡", value: 80, }, { name: "信阳", value: 35, }, { name: "漯河", value: 15, }, ], showValue: true, }, }; }, mounted() { //获取实时时间 this.timeFn(); //加载loading图 this.cancelLoading(); //中国地图 this.china_map(); //左侧玫瑰饼图 this.Rose_diagram(); //左侧柱状图 this.columnar(); //中间折线图 this.line_center_diagram(); //虚线柱状图 this.dotter_bar(); }, beforeDestroy() { //离开时删除计时器 clearInterval(this.timing); }, methods: { //右上角当前日期时间显示:每一秒更新一次最新时间 timeFn() { this.timing = setInterval(() => { //获取当前时分秒 this.dateDay = formatTime(new Date(), "HH: mm: ss"); //获取当前年月日 this.dateYear = formatTime(new Date(), "yyyy-MM-dd"); //获取当前周几 this.dateWeek = this.weekday[new Date().getDay()]; }, 1000); }, //loading图 cancelLoading() { setTimeout(() => { this.loading = false; }, 500); }, //中国地图 china_map() { let mapChart = this.$echarts.init(document.getElementById("china-map")); //图表初始化,china-map是绑定的元素 window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图 let series = []; //存放循环配置项 let res = []; //存放射线的起始点和结束点位置 let province = []; //存放有射线的省的名字,以此来拿到对应省份的坐标 //提前存好的所有省份坐标,用于后面根据名字拿到对应的左边 let chinaGeoCoordMap = { 新疆: [86.9023, 41.148], 西藏: [87.8695, 31.6846], 内蒙古: [110.5977, 41.3408], 青海: [95.2402, 35.4199], 四川: [102.9199, 30.1904], 黑龙江: [128.1445, 46.7156], 甘肃: [102.7129, 38.166], 云南: [101.0652, 24.6807], 广西: [108.7813, 23.6426], 湖南: [111.5332, 27.3779], 陕西: [108.5996, 33.7396], 广东: [113.8668, 22.8076], 吉林: [126.1746, 43.5938], 河北: [115.4004, 38.1688], 湖北: [112.2363, 30.8572], 贵州: [106.6113, 26.6385], 山东: [118.2402, 36.2307], 江西: [115.7156, 27.99], 河南: [113.0668, 33.8818], 辽宁: [123.0438, 41.0889], 山西: [112.4121, 36.6611], 安徽: [117.2461, 31.0361], 福建: [118.3008, 25.9277], 浙江: [120.498, 29.0918], 江苏: [119.8586, 32.915], 重庆: [107.7539, 29.8904], 宁夏: [105.9961, 37.1096], 海南: [109.9512, 19.2041], 台湾: [120.8254, 23.5986], 北京: [116.4551, 40.2539], 天津: [117.4219, 39.4189], 上海: [121.4648, 31.2891], 香港: [114.6178, 22.3242], 澳门: [113.5547, 21.6484], }; //后台给的数据模拟 let lineData = [ { val: 32, //数据 blat: [86.9023, 41.148], //发射点 elon: [87.8695, 31.6846], //接收点 bcitysim: "新疆", //发射省的名字 ecitysim: "西藏", //接收省的名字 }, { val: 31, blat: [87.8695, 31.6846], elon: [95.2402, 35.4199], bcitysim: "西藏", ecitysim: "青海", }, { val: 33, blat: [86.9023, 41.148], elon: [95.2402, 35.4199], bcitysim: "新疆", ecitysim: "青海", }, { val: 33, blat: [116.4551, 40.2539], elon: [119.8586, 32.915], bcitysim: "北京", ecitysim: "江苏", }, { val: 33, blat: [120.8254, 23.5986], elon: [109.9512, 19.2041], bcitysim: "台湾", ecitysim: "海南", }, { val: 33, blat: [120.498, 29.0918], elon: [115.7156, 27.99], bcitysim: "浙江", ecitysim: "江西", }, { val: 33, blat: [117.2461, 31.0361], elon: [119.8586, 32.915], bcitysim: "安徽", ecitysim: "江苏", }, { val: 33, blat: [117.2461, 31.0361], elon: [105.9961, 37.1096], bcitysim: "安徽", ecitysim: "宁夏", }, { val: 33, blat: [117.2461, 31.0361], elon: [107.7539, 29.8904], bcitysim: "安徽", ecitysim: "重庆", }, { val: 33, blat: [117.2461, 31.0361], elon: [123.0438, 41.0889], bcitysim: "安徽", ecitysim: "辽宁", }, { val: 33, blat: [119.8586, 32.915], elon: [102.7129, 38.166], bcitysim: "江苏", ecitysim: "甘肃", }, { val: 33, blat: [119.8586, 32.915], elon: [128.1445, 46.7156], bcitysim: "江苏", ecitysim: "黑龙江", }, { val: 33, blat: [119.8586, 32.915], elon: [110.5977, 41.3408], bcitysim: "江苏", ecitysim: "内蒙古", }, { val: 33, blat: [119.8586, 32.915], elon: [101.0652, 24.6807], bcitysim: "江苏", ecitysim: "云南", }, { val: 33, blat: [119.8586, 32.915], elon: [86.9023, 41.148], bcitysim: "江苏", ecitysim: "新疆", }, { val: 33, blat: [86.9023, 41.148], elon: [110.5977, 41.3408], bcitysim: "新疆", ecitysim: "内蒙古", }, { val: 33, blat: [86.9023, 41.148], elon: [102.9199, 30.1904], bcitysim: "新疆", ecitysim: "四川", }, ]; //循环拿到处理好的数据 for (var i = 0; i < lineData.length; i++) { province.push(lineData[i].bcitysim); //存进去每个省的名字 province.push(lineData[i].ecitysim); //存进去每个省的名字 res.push({ fromName: lineData[i].bcitysim, //发射的省名,保存用于弹框显示 toName: lineData[i].ecitysim, //接收的省名,保存用于弹框显示 coords: [ lineData[i].blat, //发射 lineData[i].elon, //接收 ], count: lineData[i].val, //数据 }); } let index_data = new Set(province); //把省的名字去重 let data_res = []; //定义一个新的变量存放省的坐标 //注意这里一定要用name和value的形式。不是这个格式的散点图显示不出来 index_data.forEach((item) => { data_res.push({ name: item, //每个省的名字 value: chinaGeoCoordMap[item], //每个省的坐标 }); }); //循环往series内添加配置项 series.push( { //射线效果图层 type: "lines", //类型:射线 zlevel: 1, //类似图层效果 effect: { show: true, //是否显示图标 symbol: "arrow", //箭头图标 symbolSize: 5, //图标大小 trailLength: 0.02, //特效尾迹长度[0,1]值越大,尾迹越长重 }, label: { show: true, }, lineStyle: { color: "#fff", normal: { color: "#00A0FF", width: 1, //尾迹线条宽度 opacity: 0.5, //尾迹线条透明度 curveness: 0.1, //尾迹线条曲直度 }, }, //提示框信息 tooltip: { formatter: function (param) { return ( param.data.fromName + ">" + param.data.toName + "<br>数量:" + param.data.count ); }, }, data: res, //拿到射线的起始点和结束点 }, //散点图 // { // type: "effectScatter",//散点图 // coordinateSystem: "geo",//这个不能删,删了不显示 // zlevel: 1, // rippleEffect: { // //涟漪特效 // period: 4, //动画时间,值越小速度越快 // brushType: "stroke", //波纹绘制方式 stroke, fill // scale: 4, //波纹圆环最大限制,值越大波纹越大 // }, // //设置文字部分 // label: { // normal: { // show: true, //省份名显示隐藏 // position: "right", //省份名显示位置 // offset: [5, 0], //省份名偏移设置 // formatter: function (params) { // //圆环显示省份名 // return params.name; //这个名字是根据data中的name来显示的 // }, // fontSize: 12,//文字大小 // }, // emphasis: { // show: true, // }, // }, // symbol: "circle",//散点图 // symbolSize: 5,//散点大小 // itemStyle: {//散点样式 // normal: { // show: true, // color: "#fff", // }, // }, // data: data_res, //处理好后的散点图坐标数组 // }, //点击高亮 { type: "map", mapType: "china", zlevel: 1, roam: true, geoIndex: 0, tooltip: { show: true, }, itemStyle: { areaColor: "#00196d", borderColor: "#0a53e9", }, emphasis: { show: true, label: { normal: { show: true, // 是否显示对应地名 textStyle: { color: "#fff", }, }, }, itemStyle: { areaColor: "#00196d", borderColor: "#0a53e9", }, }, } ); //配置 let option = { //title可要可不要 // title: { // text: "查查的地图", // textStyle: { // color: "#ffffff", // }, // }, legend: { show: true, selected: {}, x: "left", orient: "vertical", textStyle: { color: "white", }, data: [], }, //鼠标移上去的弹框 tooltip: { trigger: "item", show: true, }, //geo:这是重点 geo: { map: "china", //中国地图 zoom: 1.2, //缩放倍数 roam: false, //是否允许缩放和拖拽地图 label: { normal: { show: true, // 是否显示省份名字,现在是隐藏的状态,因为和散点图的名字重叠了。如果需要就true textStyle: { //名字的样式 color: "#fff", }, }, emphasis: { show: true, }, }, //地图样式 itemStyle: { normal: { borderColor: "#293171", //地图边框颜色 borderWidth: "2", //地图边框粗细 areaColor: "#0A0F33", //地图背景色 }, //省份地图阴影 emphasis: { areaColor: null, shadowOffsetX: 0, shadowOffsetY: 0, shadowBlur: 20, borderWidth: 0, shadowColor: "#fff", }, }, }, series: series, //图表配置 }; mapChart.setOption(option); //生成图表 }, //玫瑰饼图 Rose_diagram() { let mapChart = this.$echarts.init( document.getElementById("Rose_diagram") ); //图表初始化,china-map是绑定的元素 window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图 let option = { color: [ "#37a2da", "#32c5e9", "#9fe6b8", "#ffdb5c", "#ff9f7f", "#fb7293", "#e7bcf3", "#8378ea", ], tooltip: { trigger: "item", formatter: "{a} <br/>{b} : {c} ({d}%)", }, toolbox: { show: true, }, calculable: true, legend: { orient: "horizontal", icon: "circle", bottom: 0, x: "center", data: ["data1", "data2", "data3", "data4", "data5", "data6"], textStyle: { color: "#fff", }, }, series: [ { name: "通过率统计", type: "pie", radius: [10, 50], roseType: "area", center: ["50%", "40%"], data: [ { value: 10, name: "data1" }, { value: 5, name: "data2" }, { value: 15, name: "data3" }, { value: 25, name: "data4" }, { value: 20, name: "data5" }, { value: 35, name: "data6" }, ], }, ], }; mapChart.setOption(option); //生成图表 }, //柱状图 columnar() { let mapChart = this.$echarts.init(document.getElementById("columnar")); //图表初始化,china-map是绑定的元素 window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图 let option = { title: { text: "", }, tooltip: { trigger: "axis", backgroundColor: "rgba(255,255,255,0.1)", axisPointer: { type: "shadow", label: { show: true, backgroundColor: "#7B7DDC", }, }, }, legend: { data: ["已贯通", "计划贯通", "贯通率"], textStyle: { color: "#B4B4B4", }, top: "0%", }, grid: { x: "8%", width: "95%", y: "4%", }, xAxis: { data: [ "市区", "万州", "江北", "南岸", "北碚", "綦南", "长寿", "永川", "璧山", "江津", "城口", "大足", "垫江", "丰都", "奉节", "合川", "江津区", "开州", "南川", "彭水", "黔江", "石柱", "铜梁", "潼南", "巫山", "巫溪", "武隆", "秀山", "酉阳", "云阳", "忠县", "川东", "检修", ], axisLine: { lineStyle: { color: "#B4B4B4", }, }, axisTick: { show: false, }, }, yAxis: [ { splitLine: { show: false }, axisLine: { lineStyle: { color: "#B4B4B4", }, }, axisLabel: { formatter: "{value} ", }, }, ], series: [ { name: "已贯通", type: "bar", barWidth: 10, itemStyle: { normal: { barBorderRadius: 5, color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "#956FD4" }, { offset: 1, color: "#3EACE5" }, ]), }, }, data: [ 46, 50, 55, 650, 75, 85, 99, 125, 140, 215, 232, 244, 252, 333, 46, 50, 55, 65, 75, 85, 99, 225, 140, 215, 85, 99, 125, 140, 215, 232, 244, 252, 75, ], }, { name: "计划贯通", type: "bar", barGap: "-100%", barWidth: 10, itemStyle: { normal: { barBorderRadius: 5, color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "rgba(156,107,211,0.8)" }, { offset: 0.2, color: "rgba(156,107,211,0.5)" }, { offset: 1, color: "rgba(156,107,211,0.2)" }, ]), }, }, z: -12, data: [ 180, 207, 240, 283, 328, 360, 398, 447, 484, 504, 560, 626, 595, 675, 180, 207, 240, 283, 328, 360, 398, 447, 484, 504, 360, 398, 447, 484, 504, 500, 326, 495, 328, ], }, ], }; mapChart.setOption(option); //生成图表 }, //折线图 line_center_diagram() { let mapChart = this.$echarts.init( document.getElementById("line_center_diagram") ); //图表初始化,china-map是绑定的元素 window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图 let option = { xAxis: { type: "category", data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], position: "bottom", axisLine: true, axisLabel: { color: "rgba(255,255,255,.8)", fontSize: 12, }, }, yAxis: { type: "value", name: "年度生产量", nameLocation: "end", nameGap: 24, nameTextStyle: { color: "rgba(255,255,255,.5)", fontSize: 14, }, splitNumber: 4, axisLine: { lineStyle: { opacity: 0, }, }, splitLine: { show: true, lineStyle: { color: "#fff", opacity: 0.1, }, }, axisLabel: { color: "rgba(255,255,255,.8)", fontSize: 12, }, }, grid: { left: 50, right: 10, bottom: 25, top: "18%", }, series: [ { data: [820, 932, 901, 934, 1290, 1330, 1320], type: "line", smooth: true, symbol: "emptyCircle", symbolSize: 8, itemStyle: { normal: { color: "#fff", }, }, //线的颜色样式 lineStyle: { normal: { color: this.colorList.linearBtoG, width: 3, }, }, //填充颜色样式 areaStyle: { normal: { color: this.colorList.areaBtoG, }, }, }, ], }; mapChart.setOption(option); //生成图表 }, //右侧虚线柱状图图 dotter_bar() { let mapChart = this.$echarts.init(document.getElementById("dotter_bar")); //图表初始化,china-map是绑定的元素 window.onresize = mapChart.resize; //如果容器变大小,自适应从新构图 // Generate data let category = []; let dottedBase = +new Date(); let lineData = []; let barData = []; for (let i = 0; i < 20; i++) { let date = new Date((dottedBase += 3600 * 24 * 1000)); category.push( [date.getFullYear(), date.getMonth() + 1, date.getDate()].join("-") ); let b = Math.random() * 200; let d = Math.random() * 200; barData.push(b); lineData.push(d + b); } // option let option = { tooltip: { trigger: "axis", axisPointer: { type: "shadow", }, }, grid: { left: 50, right: 10, bottom: 25, top: "18%", }, legend: { data: ["line", "bar"], textStyle: { color: "#ccc", }, }, xAxis: { data: category, axisLine: { lineStyle: { color: "#ccc", }, }, }, yAxis: { splitLine: { show: false }, axisLine: { lineStyle: { color: "#ccc", }, }, }, series: [ { name: "line", type: "line", smooth: true, showAllSymbol: true, symbol: "emptyCircle", symbolSize: 15, data: lineData, }, { name: "bar", type: "bar", barWidth: 10, itemStyle: { borderRadius: 5, // color: "#14c8d4", color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "#14c8d4" }, { offset: 1, color: "#43eec6" }, ]), }, data: barData, }, { name: "line", type: "bar", barGap: "-100%", barWidth: 10, itemStyle: { // color: "rgba(20,200,212,0.5)", color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: "rgba(20,200,212,0.5)" }, { offset: 0.2, color: "rgba(20,200,212,0.2)" }, { offset: 1, color: "rgba(20,200,212,0)" }, ]), }, z: -12, data: lineData, }, { name: "dotted", type: "pictorialBar", symbol: "rect", itemStyle: { color: "#0f375f", }, symbolRepeat: true, symbolSize: [12, 4], symbolMargin: 1, z: -10, data: lineData, }, ], }; mapChart.setOption(option); //生成图表 }, },};</script><style lang="scss">//全局样式部分!!!!* { margin: 0; padding: 0; list-style-type: none; outline: none; box-sizing: border-box;}html { margin: 0; padding: 0;}body { font-family: Arial, Helvetica, sans-serif; line-height: 1.2em; background-color: #f1f1f1; margin: 0; padding: 0;}a { color: #343440; text-decoration: none;}//--------------------------------------------//页面样式部分!!!!#index { color: #d3d6dd; width: 1920px; height: 1080px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); transform-origin: left top; overflow: hidden; .bg { //整体页面背景 width: 100%; height: 100%; padding: 16px 16px 0 16px; background-image: url("../assets/pageBg.png"); //背景图 background-size: cover; //背景尺寸 background-position: center center; //背景位置 } //顶部右边装饰效果 .title_left { width: 100%; height: 50px; } //顶部左边装饰效果 .title_right { width: 100%; height: 50px; margin-top: 18px; } //顶部中间装饰效果 .title_center { width: 100%; height: 50px; } //顶部中间文字数据可视化系统 .title_text { text-align: center; font-size: 24px; font-weight: bold; margin-top: 14px; color: #008cff; } //时间日期 .title_time { text-align: center; } //中国地图 #china-map { height: 660px; width: 100%; } //中间折线图 .line_center { width: 100%; height: 288px; } //左1模块 .left_box1 { height: 310px; width: 100%; margin-bottom: 10px; position: relative; } //左2模块 .left_box2 { height: 310px; width: 100%; margin-bottom: 10px; } //左3模块 .left_box3 { height: 310px; width: 100%; } //右1模块 .right_box1 { height: 310px; width: 100%; margin-bottom: 10px; } //右2模块 .right_box2 { height: 310px; width: 100%; margin-bottom: 10px; } //右3模块 .right_box3 { height: 310px; width: 100%; } //左1模块-玫瑰饼图 #Rose_diagram { height: 70%; width: 55%; } //左1模块-圆环图 .left_box1_rose_right { height: 85%; width: 55%; position: absolute; right: 0; top: 0; } //左1模块-文字部分 .rose_text { display: inline-block; margin-top: 4%; margin-left: 4%; } // 左1模块-¥符号样式 .coin { font-size: 20px; color: #ffc107; } //左1模块-(件)样式 .colorYellow { color: yellowgreen; } //左1模块-数字样式 .rose_text_nmb { font-size: 20px; color: #00b891; } //左2模块 柱状图 #columnar { height: 97%; width: 95%; margin-left: 3%; margin-top: 5px; } //折线图 #line_center_diagram { height: 100%; width: 100%; } //轮播表格 .carousel_list { width: 96%; height: 98%; margin-left: 10px; } //虚线柱状图 #dotter_bar { width: 100%; height: 100%; } //锥形图 .cone_box { width: 95%; height: 97%; margin-left: 3%; }}</style>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
- 232
- 233
- 234
- 235
- 236
- 237
- 238
- 239
- 240
- 241
- 242
- 243
- 244
- 245
- 246
- 247
- 248
- 249
- 250
- 251
- 252
- 253
- 254
- 255
- 256
- 257
- 258
- 259
- 260
- 261
- 262
- 263
- 264
- 265
- 266
- 267
- 268
- 269
- 270
- 271
- 272
- 273
- 274
- 275
- 276
- 277
- 278
- 279
- 280
- 281
- 282
- 283
- 284
- 285
- 286
- 287
- 288
- 289
- 290
- 291
- 292
- 293
- 294
- 295
- 296
- 297
- 298
- 299
- 300
- 301
- 302
- 303
- 304
- 305
- 306
- 307
- 308
- 309
- 310
- 311
- 312
- 313
- 314
- 315
- 316
- 317
- 318
- 319
- 320
- 321
- 322
- 323
- 324
- 325
- 326
- 327
- 328
- 329
- 330
- 331
- 332
- 333
- 334
- 335
- 336
- 337
- 338
- 339
- 340
- 341
- 342
- 343
- 344
- 345
- 346
- 347
- 348
- 349
- 350
- 351
- 352
- 353
- 354
- 355
- 356
- 357
- 358
- 359
- 360
- 361
- 362
- 363
- 364
- 365
- 366
- 367
- 368
- 369
- 370
- 371
- 372
- 373
- 374
- 375
- 376
- 377
- 378
- 379
- 380
- 381
- 382
- 383
- 384
- 385
- 386
- 387
- 388
- 389
- 390
- 391
- 392
- 393
- 394
- 395
- 396
- 397
- 398
- 399
- 400
- 401
- 402
- 403
- 404
- 405
- 406
- 407
- 408
- 409
- 410
- 411
- 412
- 413
- 414
- 415
- 416
- 417
- 418
- 419
- 420
- 421
- 422
- 423
- 424
- 425
- 426
- 427
- 428
- 429
- 430
- 431
- 432
- 433
- 434
- 435
- 436
- 437
- 438
- 439
- 440
- 441
- 442
- 443
- 444
- 445
- 446
- 447
- 448
- 449
- 450
- 451
- 452
- 453
- 454
- 455
- 456
- 457
- 458
- 459
- 460
- 461
- 462
- 463
- 464
- 465
- 466
- 467
- 468
- 469
- 470
- 471
- 472
- 473
- 474
- 475
- 476
- 477
- 478
- 479
- 480
- 481
- 482
- 483
- 484
- 485
- 486
- 487
- 488
- 489
- 490
- 491
- 492
- 493
- 494
- 495
- 496
- 497
- 498
- 499
- 500
- 501
- 502
- 503
- 504
- 505
- 506
- 507
- 508
- 509
- 510
- 511
- 512
- 513
- 514
- 515
- 516
- 517
- 518
- 519
- 520
- 521
- 522
- 523
- 524
- 525
- 526
- 527
- 528
- 529
- 530
- 531
- 532
- 533
- 534
- 535
- 536
- 537
- 538
- 539
- 540
- 541
- 542
- 543
- 544
- 545
- 546
- 547
- 548
- 549
- 550
- 551
- 552
- 553
- 554
- 555
- 556
- 557
- 558
- 559
- 560
- 561
- 562
- 563
- 564
- 565
- 566
- 567
- 568
- 569
- 570
- 571
- 572
- 573
- 574
- 575
- 576
- 577
- 578
- 579
- 580
- 581
- 582
- 583
- 584
- 585
- 586
- 587
- 588
- 589
- 590
- 591
- 592
- 593
- 594
- 595
- 596
- 597
- 598
- 599
- 600
- 601
- 602
- 603
- 604
- 605
- 606
- 607
- 608
- 609
- 610
- 611
- 612
- 613
- 614
- 615
- 616
- 617
- 618
- 619
- 620
- 621
- 622
- 623
- 624
- 625
- 626
- 627
- 628
- 629
- 630
- 631
- 632
- 633
- 634
- 635
- 636
- 637
- 638
- 639
- 640
- 641
- 642
- 643
- 644
- 645
- 646
- 647
- 648
- 649
- 650
- 651
- 652
- 653
- 654
- 655
- 656
- 657
- 658
- 659
- 660
- 661
- 662
- 663
- 664
- 665
- 666
- 667
- 668
- 669
- 670
- 671
- 672
- 673
- 674
- 675
- 676
- 677
- 678
- 679
- 680
- 681
- 682
- 683
- 684
- 685
- 686
- 687
- 688
- 689
- 690
- 691
- 692
- 693
- 694
- 695
- 696
- 697
- 698
- 699
- 700
- 701
- 702
- 703
- 704
- 705
- 706
- 707
- 708
- 709
- 710
- 711
- 712
- 713
- 714
- 715
- 716
- 717
- 718
- 719
- 720
- 721
- 722
- 723
- 724
- 725
- 726
- 727
- 728
- 729
- 730
- 731
- 732
- 733
- 734
- 735
- 736
- 737
- 738
- 739
- 740
- 741
- 742
- 743
- 744
- 745
- 746
- 747
- 748
- 749
- 750
- 751
- 752
- 753
- 754
- 755
- 756
- 757
- 758
- 759
- 760
- 761
- 762
- 763
- 764
- 765
- 766
- 767
- 768
- 769
- 770
- 771
- 772
- 773
- 774
- 775
- 776
- 777
- 778
- 779
- 780
- 781
- 782
- 783
- 784
- 785
- 786
- 787
- 788
- 789
- 790
- 791
- 792
- 793
- 794
- 795
- 796
- 797
- 798
- 799
- 800
- 801
- 802
- 803
- 804
- 805
- 806
- 807
- 808
- 809
- 810
- 811
- 812
- 813
- 814
- 815
- 816
- 817
- 818
- 819
- 820
- 821
- 822
- 823
- 824
- 825
- 826
- 827
- 828
- 829
- 830
- 831
- 832
- 833
- 834
- 835
- 836
- 837
- 838
- 839
- 840
- 841
- 842
- 843
- 844
- 845
- 846
- 847
- 848
- 849
- 850
- 851
- 852
- 853
- 854
- 855
- 856
- 857
- 858
- 859
- 860
- 861
- 862
- 863
- 864
- 865
- 866
- 867
- 868
- 869
- 870
- 871
- 872
- 873
- 874
- 875
- 876
- 877
- 878
- 879
- 880
- 881
- 882
- 883
- 884
- 885
- 886
- 887
- 888
- 889
- 890
- 891
- 892
- 893
- 894
- 895
- 896
- 897
- 898
- 899
- 900
- 901
- 902
- 903
- 904
- 905
- 906
- 907
- 908
- 909
- 910
- 911
- 912
- 913
- 914
- 915
- 916
- 917
- 918
- 919
- 920
- 921
- 922
- 923
- 924
- 925
- 926
- 927
- 928
- 929
- 930
- 931
- 932
- 933
- 934
- 935
- 936
- 937
- 938
- 939
- 940
- 941
- 942
- 943
- 944
- 945
- 946
- 947
- 948
- 949
- 950
- 951
- 952
- 953
- 954
- 955
- 956
- 957
- 958
- 959
- 960
- 961
- 962
- 963
- 964
- 965
- 966
- 967
- 968
- 969
- 970
- 971
- 972
- 973
- 974
- 975
- 976
- 977
- 978
- 979
- 980
- 981
- 982
- 983
- 984
- 985
- 986
- 987
- 988
- 989
- 990
- 991
- 992
- 993
- 994
- 995
- 996
- 997
- 998
- 999
- 1000
- 1001
- 1002
- 1003
- 1004
- 1005
- 1006
- 1007
- 1008
- 1009
- 1010
- 1011
- 1012
- 1013
- 1014
- 1015
- 1016
- 1017
- 1018
- 1019
- 1020
- 1021
- 1022
- 1023
- 1024
- 1025
- 1026
- 1027
- 1028
- 1029
- 1030
- 1031
- 1032
- 1033
- 1034
- 1035
- 1036
- 1037
- 1038
- 1039
- 1040
- 1041
- 1042
- 1043
- 1044
- 1045
- 1046
- 1047
- 1048
- 1049
- 1050
- 1051
- 1052
- 1053
- 1054
- 1055
- 1056
- 1057
- 1058
- 1059
- 1060
- 1061
- 1062
- 1063
- 1064
- 1065
- 1066
- 1067
- 1068
- 1069
- 1070
- 1071
- 1072
- 1073
- 1074
- 1075
- 1076
- 1077
- 1078
- 1079
- 1080
- 1081
- 1082
- 1083
- 1084
- 1085
- 1086
- 1087
- 1088
- 1089
- 1090
- 1091
- 1092
- 1093
- 1094
- 1095
- 1096
- 1097
- 1098
- 1099
- 1100
- 1101
- 1102
- 1103
- 1104
- 1105
- 1106
- 1107
- 1108
- 1109
- 1110
- 1111
- 1112
- 1113
- 1114
- 1115
- 1116
- 1117
- 1118
- 1119
- 1120
- 1121
- 1122
- 1123
- 1124
- 1125
- 1126
- 1127
- 1128
- 1129
- 1130
- 1131
- 1132
- 1133
- 1134
- 1135
- 1136
- 1137
- 1138
- 1139
- 1140
- 1141
- 1142
- 1143
- 1144
- 1145
- 1146
- 1147
- 1148
- 1149
- 1150
- 1151
- 1152
- 1153
- 1154
- 1155
- 1156
- 1157
- 1158
- 1159
- 1160
- 1161
- 1162
- 1163
- 1164
- 1165
- 1166
- 1167
- 1168
- 1169
- 1170
- 1171
- 1172
- 1173
- 1174
- 1175
- 1176
- 1177
- 1178
- 1179
- 1180
- 1181
- 1182
- 1183
- 1184
- 1185
- 1186
- 1187
- 1188
- 1189
- 1190
- 1191
- 1192
- 1193
- 1194
- 1195
- 1196
- 1197
- 1198
- 1199
- 1200
- 1201
- 1202
- 1203
- 1204
- 1205
- 1206
- 1207
- 1208
- 1209
- 1210
- 1211
- 1212
- 1213
- 1214
- 1215
- 1216
- 1217
- 1218
- 1219
- 1220
- 1221
- 1222
- 1223
- 1224
- 1225
- 1226
- 1227
- 1228
- 1229
- 1230
- 1231
- 1232
- 1233
- 1234
- 1235
- 1236
- 1237
- 1238
- 1239
- 1240
- 1241
- 1242
- 1243
- 1244
- 1245
- 1246
- 1247
- 1248
- 1249
- 1250
- 1251
- 1252
- 1253
- 1254
- 1255
- 1256
- 1257
- 1258
- 1259
- 1260
- 1261
- 1262
- 1263
- 1264
- 1265
- 1266
- 1267
- 1268
- 1269
- 1270
- 1271
- 1272
- 1273
- 1274
- 1275
- 1276
- 1277
- 1278
- 1279
- 1280
- 1281
- 1282
- 1283
- 1284
- 1285
- 1286
- 1287
- 1288
- 1289
- 1290