vue 项目下使用dataV和echarts 开发可视化大屏

本文主要是介绍vue 项目下使用dataV和echarts 开发可视化大屏,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

先贴效果图,静态图开不出动态效果。
在这里插入图片描述
首先得安装依赖
“@jiaminghi/data-view”: “^2.10.0”,
“echarts”: “^5.2.1”,
“screenfull”: “^5.2.0”,

首页代码

<template><div :class="figureBG == 1 ? 'figure-page' : 'figure-page'" ref="figure" class="img_bg"><dv-decoration-9 class="loading" v-if="isShowLoading"><dv-digital-flop class="schedule" :config="configLoad" /></dv-decoration-9><dv-full-screen-container><div>&nbsp;</div><template v-if="!isShowLoading"><!-- 第一行 --><!-- <div class="jc-center"><dv-decoration-10 style="width: 33.3%; height: 5px" /><div class="jc-center"><dv-decoration-8:color="color"style="width: 200px; height: 50px"/><div class="title"><span class="title-text">车险人伤第三方机构多维数字化看板</span><dv-decoration-6class="title-bototm":reverse="true":color="['#50e3c2', '#67a1e5']"style="width: 130px; height: 18px"/></div><dv-decoration-8:reverse="true":color="color"style="width: 200px; height: 50px"/></div><dv-decoration-10style="width: 33.3%; height: 5px; transform: rotateY(180deg)"/></div> --><dv-border-box-11 title="大数据展示" class="box_11"><!-- 第二行 --><div class="jc-between"><div class="d-flex" style="width: 40%"><divclass="react-right ml-4"style="width: 625px; text-align: left; background-color: #233556"@click="toBack"><span class="react-before"></span><span class="text">返回上级页面</span></div><divclass="react-right bg-color-blue ml-3"@click="handleScreenfull"><span class="text">全屏展示</span></div></div><dv-decoration-5 style="width:300px;height:40px;" />"<div style="width: 40%" class="d-flex"><divclass="react-left mr-3"style="background-color: #233556"@click="toggleBg"><span class="text fw-b"></span></div><divclass="react-left mr-4"style="width: 625px; background-color: #233556; text-align: right"><span class="react-after"></span><div class="date-row text react-left_qj"><span class="title_qj">数据统计区间:&nbsp;</span><el-date-pickerclass="daterange_qj"v-model="date"type="daterange"align="right"unlink-panelsrange-separator="至"start-placeholder="开始日期"end-placeholder="结束日期":picker-options="pickerOptions"@change="init"></el-date-picker></div></div></div></div><div class="table-flex-box"><Left ref="left" /><Center ref="center" /><Right ref="right" /></div></dv-border-box-11>    </template></dv-full-screen-container></div></template><script>import Vue from 'vue'import dataV from '@jiaminghi/data-view'import * as echarts from 'echarts/core'import { BarChart } from 'echarts/charts'import screenfull from 'screenfull'//   import Left from '@/components/board/Left'import Left from './board/Left'import Center from './board/Center'import Right from './board/Right'Vue.use(dataV)// 注册必须的组件echarts.use([BarChart])export default {data() {let end = new Date()let start = new Date(`2022/01/01`)return {color: ['#568aea', '#020814'], // 第一行的背景色screenfullBut: false, //全屏configLoad: {// 加载数值number: [parseInt(parseInt(Math.random() * 20) + 30)],content: '{nt}%',style: {fontSize: 18,fill: '#3de7c9'}},isShowLoading: true, // 展示加载figureBG: 1, // 背景模式 1图片 0纯色date: [start, end], //选择时间pickerOptions: {shortcuts: [{text: '最近一个月',onClick(picker) {const end = new Date()const start = new Date()start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)picker.$emit('pick', [start, end])}},{text: '最近三个月',onClick(picker) {const end = new Date()const start = new Date()start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)picker.$emit('pick', [start, end])}},{text: '最近一年',onClick(picker) {const end = new Date()const start = new Date()start.setTime(start.getTime() - 3600 * 1000 * 24 * 365)picker.$emit('pick', [start, end])}}]}}},components: {Left,Center,Right},created() {if (localStorage.hasOwnProperty('figure-bg')) {// 初始化背景this.figureBG = localStorage.getItem('figure-bg')if (this.figureBG == 0) {this.color = ['#568aea', '#0e2140']}}},mounted() {for (let i = 0; i <= 4; i++) {setTimeout(() => {if (i == 4) {this.isShowLoading = falsethis.$nextTick(() => {this.init()})return}let num = i == 3 ? 100 : parseInt(Math.random() * 15) + 50 + 15 * ithis.configLoad = {number: [num],content: '{nt}%',style: {fontSize: 18,fill: '#3de7c9'}}}, i * 100)}},methods: {init() {// 传入时间,组件根据时间重新获取数据if (Object.is(this.date, null) || !(this.date instanceof Array)) {return}let start = new Date(this.date[0])let end = new Date(this.date[1])start = `${start.getFullYear()}-${this.fillNum(start.getMonth() + 1)}-${this.fillNum(start.getDate())} 00:00:00`end = `${end.getFullYear()}-${this.fillNum(end.getMonth() + 1)}-${this.fillNum(end.getDate())} 23:59:59`this.$refs.left.componentInit(start, end)this.$refs.center.componentInit(start, end)this.$refs.right.componentInit(start, end)},fillNum(num, size = 2) {return String.prototype.padStart.call(num, size, '0')},handleScreenfull() {if (!screenfull.isEnabled) {this.$message.error('您的浏览器无法使用全屏功能,请更换谷歌浏览器或者请手动点击F11按钮全屏展示!')

这篇关于vue 项目下使用dataV和echarts 开发可视化大屏的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/277593

相关文章

CSS @media print 使用详解

《CSS@mediaprint使用详解》:本文主要介绍了CSS中的打印媒体查询@mediaprint包括基本语法、常见使用场景和代码示例,如隐藏非必要元素、调整字体和颜色、处理链接的URL显示、分页控制、调整边距和背景等,还提供了测试方法和关键注意事项,并分享了进阶技巧,详细内容请阅读本文,希望能对你有所帮助...

使用Folium在Python中进行地图可视化的操作指南

《使用Folium在Python中进行地图可视化的操作指南》在数据分析和可视化领域,地图可视化是一项非常重要的技能,它能够帮助我们更直观地理解和展示地理空间数据,Folium是一个基于Python的地... 目录引言一、Folium简介与安装1. Folium简介2. 安装Folium二、基础使用1. 创建

Java中Runnable和Callable的区别和联系及使用场景

《Java中Runnable和Callable的区别和联系及使用场景》Java多线程有两个重要的接口,Runnable和Callable,分别提供一个run方法和call方法,二者是有较大差异的,本文... 目录一、Runnable使用场景二、Callable的使用场景三、关于Future和FutureTa

使用EasyExcel实现简单的Excel表格解析操作

《使用EasyExcel实现简单的Excel表格解析操作》:本文主要介绍如何使用EasyExcel完成简单的表格解析操作,同时实现了大量数据情况下数据的分次批量入库,并记录每条数据入库的状态,感兴... 目录前言固定模板及表数据格式的解析实现Excel模板内容对应的实体类实现AnalysisEventLis

使用国内镜像源优化pip install下载的方法步骤

《使用国内镜像源优化pipinstall下载的方法步骤》在Python开发中,pip是一个不可或缺的工具,用于安装和管理Python包,然而,由于默认的PyPI服务器位于国外,国内用户在安装依赖时可... 目录引言1. 为什么需要国内镜像源?2. 常用的国内镜像源3. 临时使用国内镜像源4. 永久配置国内镜

Go语言中最便捷的http请求包resty的使用详解

《Go语言中最便捷的http请求包resty的使用详解》go语言虽然自身就有net/http包,但是说实话用起来没那么好用,resty包是go语言中一个非常受欢迎的http请求处理包,下面我们一起来学... 目录安装一、一个简单的get二、带查询参数三、设置请求头、body四、设置表单数据五、处理响应六、超

如何使用C#串口通讯实现数据的发送和接收

《如何使用C#串口通讯实现数据的发送和接收》本文详细介绍了如何使用C#实现基于串口通讯的数据发送和接收,通过SerialPort类,我们可以轻松实现串口通讯,并结合事件机制实现数据的传递和处理,感兴趣... 目录1. 概述2. 关键技术点2.1 SerialPort类2.2 异步接收数据2.3 数据解析2.

详解如何使用Python提取视频文件中的音频

《详解如何使用Python提取视频文件中的音频》在多媒体处理中,有时我们需要从视频文件中提取音频,本文为大家整理了几种使用Python编程语言提取视频文件中的音频的方法,大家可以根据需要进行选择... 目录引言代码部分方法扩展引言在多媒体处理中,有时我们需要从视频文件中提取音频,以便进一步处理或分析。本文

使用Dify访问mysql数据库详细代码示例

《使用Dify访问mysql数据库详细代码示例》:本文主要介绍使用Dify访问mysql数据库的相关资料,并详细讲解了如何在本地搭建数据库访问服务,使用ngrok暴露到公网,并创建知识库、数据库访... 1、在本地搭建数据库访问的服务,并使用ngrok暴露到公网。#sql_tools.pyfrom

使用mvn deploy命令上传jar包的实现

《使用mvndeploy命令上传jar包的实现》本文介绍了使用mvndeploy:deploy-file命令将本地仓库中的JAR包重新发布到Maven私服,文中通过示例代码介绍的非常详细,对大家的学... 目录一、背景二、环境三、配置nexus上传账号四、执行deploy命令上传包1. 首先需要把本地仓中要