echarts legend 背景色渐变

问题与本文无关:如果检测软件显示loadsh.js 的版本是4.17.10 装element-ui 2.15.8版本以下,2.15.6经过测试可以

代码:

<template><div class="levelMain"><div class="survey-head"><div class="survey-title"><img src="../../assets/img/v3/v301.png" alt />云计算总览</div></div><div class="echartsmain clearfix"><div class="level clearfix"><div class="changeTitle"><div class="levelcm" @click="kehuJump"><img src="../../assets/img/v3/v305.png" alt />业务概况</div><div class="sj_khqk"><span :class="{ isClassColor: isClass == 2 }" style="margin-right: 5px" @click="handlelevel(2)">云平台类型</span><span :class="{ isClassColor: isClass == 1 }" @click="handlelevel(1)">租户类型</span></div></div><div class="level-chat-wrap"><div id="main-yewu" class="main-yewu newclass" style="height: 220px; width: 216px"></div><div class="level-chat-legend"><div class="legend-item" :style="getBackground(index)" v-for="(item, index) in legendData" :key="item.name"><div class="legend-item-icon" :style="{ background: colors[index] }"></div><div class="legend-item-label">{{ item.name }}</div><div class="legend-item-num"><numAnimation :num="item.value" :style="{ color: colors[index] }"></numAnimation></div></div></div></div></div><div class="industry"><div class="changeTitle" style="margin-left: 16px"><div class="levelcm" @click="yewuJump"><img src="../../assets/img/v3/v305.png" alt />资源概况</div><div class="sj_khqk"><span :class="{ isClassColor: isClass1 == 1 }" style="margin-right: 5px" @click="handlelevel1(1)">云产品</span><span :class="{ isClassColor: isClass1 == 2 }" @click="handlelevel1(2)">物理设备</span></div></div><ul class="industryBox"><li v-for="(item, index) in ziyuanList" :key="index"><span>{{ item.name }}</span><NumAnimation :num="item.count"></NumAnimation></li></ul></div></div></div>
</template>
<script>
const colors1 = ['#40c2c1', '#0e9bfe', '#27d280', '#5ED2F9'];
// const colors2 = ['#0EFEFE','#0E9BFE','#27D280', '#da55ba', '#6fd3b7', '#605edf', '#ef9c57', '#dd645f', '#ebe793', '#49abe6']
const colors2 = ['#35EDA0', '#26CBFF', '#369FFF', '#0FF', '#83F7B2', '#605edf', '#ef9c57', '#dd645f', '#ebe793', '#49abe6'];
const colors3 = ['rgba(53,237,160,0.3)','rgba(38,203,255,0.3)','rgba(54,159,255,0.3)','rgba(0,255,255,0.3)','rgba(131,247,178,0.3)','rgba(96,94,223,0.3)','rgba(239,156,87,0.3)','rgba(221, 100, 95,0.3)'
];
import * as math from 'mathjs';
import * as echarts from 'echarts';
import NumAnimation from '@/components/numAnimation.vue';
import { getReq, postReq, postReqJson } from '@/api/index.js';export default {name: 'level',components: {NumAnimation},props: {reqData: {type: Object,default: {}}},data() {return {value: '客户概况',profession: [],count: [],chartData: [],ziyuanList: [],isClass: 2,isClass1: 1,colors: colors2,myChart: null};},computed: {legendData: function () {return this.chartData;}},// 自动刷新inject: ['loop'],watch: {loop: {handler(newVal) {this.handlelevel(this.isClass); //专网统计this.handlelevel1(this.isClass1); //资源概况},deep: true},reqData: {handler(newVal) {this.handlelevel(this.isClass); //专网统计this.handlelevel1(this.isClass1); //资源概况},deep: true,immediate: true}},mounted() {this.handlelevel(this.isClass); //专网统计this.handlelevel1(this.isClass1); //资源概况},beforeDestroy() {this.myChart && this.myChart.dispose();this.myChart = null;},methods: {getBackground(index) {// return `background-image: linear-gradient(270deg, rgba(53, 237, 160, 0.00) 0.05%, ${this.colors[index]} 99.95%);`return `background-image: linear-gradient(270deg, rgba(53, 237, 160, 0.00) 0.05%, ${colors3[index]} 99.95%);`;},handlelevel(text) {this.isClass = text;this.colors = colors2;let data = this.reqData.yewugaikuang;if (text == 2) {// 云平台类型if (data) {data.yunpingtaileixing.forEach((v) => {v['value'] = v.count;});this.chartData = data.yunpingtaileixing;this.getData();}} else {// 租户类型if (data) {data.zuhuleixing.forEach((v) => {v['value'] = v.count;});this.chartData = data.zuhuleixing;this.getData();}}},handlelevel1(text) {this.isClass1 = text;let data = this.reqData.ziyuangaikuang;if (text == 1) {// 云产品if (data) {this.ziyuanList = data.yunchanpin;}} else {// 物理设备if (data) {this.ziyuanList = data.wulishebei;}}},getData() {//专网统计this.myChart = echarts.init(document.getElementById('main-yewu'));const chartData = this.chartData;// const colorList = ['#379dfc', '#f8d15a', '#a1b5d3', '#27d280']const sum = chartData.reduce((per, cur) => per + cur.value, 0);const gap = (1 * sum) / 100;const pieData1 = [];const pieData2 = [];const gapData = {name: '',value: gap,itemStyle: {color: 'transparent'}};for (let i = 0; i < chartData.length; i++) {// 第一圈数据pieData1.push({...chartData[i],itemStyle: {borderRadius: 1}});pieData1.push(gapData);// 第二圈数据pieData2.push({...chartData[i],itemStyle: {color: this.colors[i],opacity: 0.2}});pieData2.push(gapData);}let titles = this.isClass == '1' ? '专网总量' : '行业总量';let option = {title: {text: `{a|${sum}}\n{c|${titles}}`,// x: '33%',//   y: '44%',left: 'center',top: 'center',textStyle: {rich: {a: {color: '#00f1ff',fontSize: '16',fontWeight: 'bold'},c: {fontSize: '12',color: '#BDE7FA',padding: [5, 0, 6, 0]}}}},tooltip: {trigger: 'item',axisPointer: {// 坐标轴指示器,坐标轴触发有效 设置鼠标放上去是线还是阴影type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'}},legend: {show: false,// type: 'scroll',// orient: 'vertical',right: 0,// top: 'center',itemGap: 20,itemWidth: 10,itemHeight: 10,// backgroundColor: 'rgba(13,22,76,0.9)',// padding: [5, 10],textStyle: {color: '#fff',fontSize: 12,borderWidth: 10 // 间距的宽度}// formatter: (name) => {//   const item = chartData.filter((item) => item.moduleType == name)[0]//   if (name != '') {//     return name + '   ' + item.value//   }// },},grid: {top: 20,right: 10,bottom: 20,left: 10,containLabel: true},color: this.colors,series: [{name: '',type: 'pie',roundCap: true,radius: ['47%', '53%'],// hoverOffset: 5,label: {show: true,formatter: function (params) {let num = math.number(math.divide(math.bignumber(params.value), math.bignumber(sum)));let twoFixed = Math.floor(num * 10000) / 100;return `{name|${twoFixed}%}`;},textStyle: {//   fontSize: 12,rich: {name: {fontSize: 12,fontWeight: 700,color: 'inherit',padding: [-22, -48, 0, -40]}}},position: 'outside',emphasis: {show: true,itemStyle: {}}},labelLine: {show: true,length: 10,length2: 40},data: pieData1},{type: 'pie',radius: ['47%', '38%'],// center: ['45%', '50%'],gap: 1.71,label: {show: false},labelLine: {show: false},silent: true,data: pieData2},{type: 'pie',name: '',radius: ['58%', '58.5%'],silent: true,startAngle: '360',endAngle: '0',data: [{value: 0,selected: false,labelLine: {show: false,length: 0,length2: 0,lineStyle: {color: '#fff'}},itemStyle: {label: {show: false}}}],itemStyle: {color: '#40C2C1',opacity: 0.45,label: {show: false},labelLine: {opacity: 0,show: false,length: 0,length2: 0,lineStyle: {color: '#fff'}}},hoverAnimation: false},{type: 'pie',radius: ['31%', '31.5%'],data: [100],color: ['#39D1FA5C'],label: {show: false},silent: true}]};this.myChart.clear();this.myChart.resize();this.myChart.setOption(option, true);},kehuJump() {// window.open(`http://10.7.38.84:37799/webroot/decision/v10/entry/access/2e7ec9ae-bd46-49e4-95f0-038d20c863a6?ssoToken=pb453S%2BRSu1BqSB97IFsJhRq2cfGNITYIausH01BwbSIcDxk%2FQqDeHA9%2FJcLh5WOVQ3%2FIjeV7HSXn6Cid%2B9UkjzFvZOku3vLGoF1%2FlQ9LtdQqrczx5pWFp7uDsGkB03uCU1Y%2FDrpnB%2BfkrUxH%2FtGpioaq4TCDDHFUNwTpADUxPYS4%2BkojpNMpu6ahzDZ5t7W9VZchy4K8rbtSR2FS5lkcIpt%2FmpHLqMlFZ8FVTllZlTL1ZEqFkX2piFmgVVtJtm85HUIVXgNLWaWpl7HHZHphuQRGYQ%2F39ck51WLL3IxBhq9DqgmCyqSgNdARTzw8npLuFkO1WIuVqysTwBOWC%2Bg6Q%3D%3D`)},yewuJump() {// window.open(`http://10.7.38.84:37799/webroot/decision/v10/entry/access/a13d36b6-0d06-4955-990c-fc98f94f1c89?ssoToken=pb453S%2BRSu1BqSB97IFsJhRq2cfGNITYIausH01BwbSIcDxk%2FQqDeHA9%2FJcLh5WOVQ3%2FIjeV7HSXn6Cid%2B9UkjzFvZOku3vLGoF1%2FlQ9LtdQqrczx5pWFp7uDsGkB03uCU1Y%2FDrpnB%2BfkrUxH%2FtGpioaq4TCDDHFUNwTpADUxPYS4%2BkojpNMpu6ahzDZ5t7W9VZchy4K8rbtSR2FS5lkcIpt%2FmpHLqMlFZ8FVTllZlTL1ZEqFkX2piFmgVVtJtm85HUIVXgNLWaWpl7HHZHphuQRGYQ%2F39ck51WLL3IxBhq9DqgmCyqSgNdARTzw8npLuFkO1WIuVqysTwBOWC%2Bg6Q%3D%3D`)}}
};
</script>
<style lang="scss" scoped>
.survey-head {align-items: center;.no-boder-slct {>>> input {border: 0;background: transparent;color: #fff;width: 110px;}}.survey-title {display: flex;align-items: center;font-size: 18px;font-weight: 700;background-image: linear-gradient(0deg, #0ff 24.7%, #1e9bff 89%);-webkit-background-clip: text;color: transparent;img {width: 16px;height: 16px;display: inline-block;margin-right: 10px;}}
}.echartsmain {float: left;// width: 821px;text-align: left;font-size: 14px;display: flex;align-items: center;
}
.echartsmain .level-chat-wrap {// flex: 1;// width: 100%;display: flex;align-items: center;justify-content: space-between;
}.echartsmain .level {width: 440px;height: 280px;box-sizing: border-box;
}
.echartsmain .level-chat-legend {padding: 10px 10px 10px 0;box-sizing: border-box;width: 156px;height: 218px;overflow-y: auto;display: flex;flex-direction: column;justify-content: space-evenly;
}
.echartsmain .legend-item {white-space: nowrap;height: 28px;display: flex;align-items: center;// background: url('../../assets/img/v3/llenged-bg.png') no-repeat;background-size: 100% 100%;padding: 0 10px;font-size: 12px;padding: 10px 0;
}
// .echartsmain .legend-item + .legend-item {
//   margin-top: 20px;
// }
.echartsmain .legend-item-icon {// width: 10px;// height: 10px;// background: red;// margin-right: 10px;// border-radius: 2px;width: 3px;height: 28px;background: red;margin-right: 10px;
}
.echartsmain .legend-item-label {font-size: 12px;color: #ffffff;
}
.echartsmain .legend-item-num {font-size: 12px;color: #ffffff;margin-left: auto;font-weight: bold;
}
.echartsmain .industry {flex: 1;// width: 50%;width: 470px;height: 280px;padding: 0 10px;-webkit-box-sizing: border-box;box-sizing: border-box;float: left;border-radius: 13px;.industryBox {width: 420px;height: 256px;background: url('../../assets/img/v3/v3left03.png') no-repeat center;background-size: 100% 100%;position: relative;li {display: flex;flex-direction: column;align-items: center;justify-content: center;span:nth-child(1) {color: #e1ffff;font-size: 14px;width: 82px;}span:nth-child(2) {color: #0ff;font-size: 24px;font-weight: 600;width: 82px;}}li:nth-child(1) {position: absolute;// top: 55px;// left: 55px;top: 30%;left: 23%;transform: translate(-50%, -50%);}li:nth-child(2) {position: absolute;top: 30%;right: -5%;transform: translate(-50%, -50%);}li:nth-child(3) {position: absolute;bottom: 10%;left: 23%;transform: translate(-50%, -50%);}li:nth-child(4) {position: absolute;bottom: 10%;right: -3.4%;transform: translate(-40%, -50%);}}
}.title {font-size: 16px;color: #fff;padding-left: 15px;
}.levelMain {width: 928px;height: 365px;padding: 20px;box-sizing: border-box;background: url('../../assets/img/v3/customerv3left1.png');background-repeat: no-repeat;background-size: 100% 100%;background-position: center;
}.el-input__inner {width: 130px;height: 24px;background: none;border: none;height: inherit;font-size: 18px;color: #00ddec;
}.el-select .el-input__inner {padding-right: 0px;
}::v-deep .el-form-item {margin-bottom: 0px !important;
}.el-select .el-input .el-select__caret {display: none;
}::v-deep .el-form-item--mini.el-form-item,
.el-form-item--small.el-form-item {margin-bottom: 0px !important;
}.echartsmain .main-yewu {//   width: 100%;// flex: 2;height: 250px;
}::v-deep .survey-title input {border: 0;background: transparent !important;color: #00ddec;font-family: MicrosoftYaHei-Bold;font-size: 18px;font-weight: normal;width: 140px;
}.isClassColor {// color: #4bc6fb;color: #0ff !important;width: 86px;// height: 20px;background: url('../../assets/img/v3/v3tab01ed.png') no-repeat center 5px !important;text-align: center;line-height: 20px;
}.changeTitle {display: flex;align-items: center;justify-content: space-between;line-height: 30px;margin-top: 15px;.levelcm {// width: 178px;// font-size: 16px;// color: #ffffff;// background-image: linear-gradient(90deg, rgba(0, 60, 130, 0), rgba(0, 60, 130, 1), rgba(0, 60, 130, 0));// text-align: center;// margin: 0 auto;display: flex;align-items: center;font-size: 16px;color: #fff;margin-left: -10px;padding-top: 10px;img {width: 40px;height: 36px;display: inline-block;margin-right: -2px;}}.sj_khqk {color: #f0f0f0;margin-right: 10px;cursor: pointer;display: flex;justify-content: flex-end;margin-top: 15px;width: 184px;height: 28px;background: url('../../assets/img/v3/v3tab.png') no-repeat 2px center;background-size: 100% 100%;span {color: #f0f0f0;width: 86px;// height: 20px;background: url('../../assets/img/v3/v3tab01.png') no-repeat center 5px;text-align: center;line-height: 20px;}}
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/854733.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

RK3568平台(音频篇)声音的数字化和数字音频接口

一.声音信号的数字化 我们应该都知道&#xff0c;声音是一种模拟信号&#xff0c;如果想用于计算机&#xff0c;就必须要将模拟信号转换为数字信号&#xff0c;这样&#xff0c;我们就能在计算机上存储声音了&#xff0c;等待用户想播放的时候&#xff0c;再将数字信号转换为模…

【Java】已解决java.lang.CloneNotSupportedException异常

文章目录 问题背景可能出错的原因错误代码示例正确代码示例注意事项 已解决java.lang.CloneNotSupportedException异常 在Java编程中&#xff0c;java.lang.CloneNotSupportedException是一个常见的运行时异常&#xff0c;它发生在尝试调用对象的clone()方法时&#xff0c;但该…

有哪些零售O2O应用模式?如何构建O2O闭环生态系统?

在零售业的演变历程中&#xff0c;O2O模式的兴起标志着一个新时代的开始。这种模式以其创新性&#xff0c;将线上的便捷与线下的实体体验完美融合&#xff0c;为消费者带来了前所未有的购物便利和体验丰富性。随着技术的不断进步和消费者需求的日益多样化&#xff0c;O2O模式已…

在windows 台式机电脑部署GLM4大模型

参考这篇文章在windows笔记本电脑部署GLM4大模型_16g显卡本地部署glm4-CSDN博客 我的环境&#xff08;PC台式机电脑&#xff1a; 处理器 Intel(R) Core(TM) i9-14900K 3.20 GHz 机带 RAM 32.0 GB (31.8 GB 可用)、32G内存、NVIDIA RTX4080&#xff08;16G&#xff09;…

Ubuntu20.04中复现FoundationPose

Ubuntu20.04中复现FoundationPose 文章目录 Ubuntu20.04中复现FoundationPose1.安装cuda和cudnn2.下载相关资源3.环境配置4.运行model-based demo5.运行ycbv demoReference &#x1f680; 非常重要的环境配置 &#x1f680; ubuntu 20.04cuda 11.8.0cudnn v8.9.7python 3.9.19…

如何理解电流镜负载的差分对的增益

我们知道最普通的电阻负载的差分对的差分增益是-gmRD&#xff0c;如果我们不希望输出是双端的&#xff0c;而是希望单端输出&#xff0c;那么使用电阻负载的差分对会导致增益变为原先的一半&#xff0c;因此引入了电流镜负载的差分对&#xff0c;它可以在保证增益与原先相同的情…

Nuxt快速学习开发 - Nuxt3静态资源Assets

Nuxt 使用两个目录来处理样式表、字体或图像等资产。 public/目录内容按原样在服务器根目录中提供。 assets/目录包含您希望构建工具&#xff08;Vite 或 webpack&#xff09;处理的所有资产。 public/目录 public目录用作静态资产的公共服务器&#xff0c;可在您的应用程序定…

氮化铝上的厚膜高功率片式电阻器

EAK厚膜高功率片式电阻器和氮化铝片式端接非常适合大多数需要在小尺寸封装中实现高导热性的应用。AlN 是 BeO 的理想替代品&#xff0c;具有高功耗且对环境或健康无危害。厚膜技术以非常实惠的价格提供稳定的电阻元件。 高稳定性厚膜电阻元件 AlN衬底材料 标准电阻范围为 10Ω…

5216万!国内自动化巨头,拟剥离旗下子业务

导语 大家好&#xff0c;我是社长&#xff0c;老K。专注分享智能制造和智能仓储物流等内容。 新书《智能物流系统构成与技术实践》 近日&#xff0c;中控技术发布公告称&#xff0c;为进一步优化资产结构和产业布局&#xff0c;提升公司核心竞争力&#xff0c;公司拟将其全资子…

多模态LLM 跨越语言与视觉的边界

一、引言 在数字时代的浪潮中&#xff0c;我们被由语言和视觉等多种模态构成的信息海洋所包围。人类大脑以其卓越的多模态上下文理解能力&#xff0c;在日常任务中游刃有余。然而&#xff0c;在人工智能领域&#xff0c;如何将这种能力赋予机器&#xff0c;尤其是如何在语言模…

MybatisPlus:高效便捷的Java持久层框架

一、MybatisPlus简介 MybatisPlus&#xff08;简称MP&#xff09;是一个流行的Java持久层框架&#xff0c;在 MyBatis 的基础上只做增强不做改变&#xff0c;为简化开发、提高效率而生&#xff0c;旨在简化数据库操作和提高开发效率。MybatisPlus为开发者提供了一套方便的API和…

About Apple Pay

本文翻译整理自&#xff1a;About Apple Pay &#xff08;更新时间&#xff1a;2017-03-16&#xff09; https://developer.apple.com/library/archive/ApplePay_Guide/index.html#//apple_ref/doc/uid/TP40014764 文章目录 一、关于 Apple Pay1、使用 Apple Pay2、测试 Apple …

SpringBoot3整合SpringDoc实现在线接口文档

写在前面 在现目前项目开发中&#xff0c;一般都是前后端分离项目。前端小姐姐负责开发前端&#xff0c;苦逼的我们负责后端开发 事实是一个人全干&#xff0c;在这过程中编写接口文档就显得尤为重要了。然而作为一个程序员&#xff0c;最怕的莫过于自己写文档和别人不写文档…

【数据结构(邓俊辉)学习笔记】二叉搜索树02——查找、插入和删除

文章目录 1.概述2. 查找2.1 查找&#xff1a;算法2.2 查找&#xff1a;理解2.3 查找&#xff1a;实现2.4 查找&#xff1a;语义 3. 插入3.1 插入&#xff1a;算法3.2 插入&#xff1a;实现 4. 删除4.1 删除&#xff1a;框架4.2 删除&#xff1a;单分支4.3 删除&#xff1a;双分…

Pyqt QCustomPlot 简介、安装与实用代码示例(一)

目录 简介安装实用代码示例带有填充的简单衰减正弦函数及其红色的指数包络线具有数据点的 sinc 函数、相应的误差条和 2--sigma 置信带几种散点样式的演示展示 QCustomPlot 在设计绘图方面的多功能性 结语 所有文章除特别声明外&#xff0c;均采用 CC BY-NC-SA 4.0 许可协议。转…

RERCS系统开发实战案例-Part05 FPM Application的Feeder Class搜索组件的实施

1、通过事务码 SE24对Feeder Class实施 1&#xff09;接口页签的简单说明&#xff1a; ① IF_FPM_GUIBB&#xff1a;通用UI构建块&#xff0c;整个UIBB模块的基础接口&#xff1b; ② IF_FPM_GUIBB_SEARCH&#xff1a;通用搜索UI构建块&#xff0c;搜索组件UIBB的基础接口&…

期末复习GGG-----查找子串

郭的 char *search( char *s, char *t ){int i0;while(s[i]){int j0;if(s[i]t[0]){while(s[ij]t[j]&&t[j]){j;}if(t[j]\0)return si;}i;}return NULL; } AI的 #include <stdio.h> #include <string.h> #define MAXS 30char *search(char *s, char *t);in…

ctfshow web七夕杯

web签到 执行命令没有回显&#xff0c;我们直接写文件就可以了 有字符长度限制 ls />a nl /*>a访问url/api/a下载文件 easy_calc <?phpif(check($code)){eval($result."$code".";");echo($result); }function check(&$code){$num1…

Golang | Leetcode Golang题解之第164题最大间距

题目&#xff1a; 题解&#xff1a; type pair struct{ min, max int }func maximumGap(nums []int) (ans int) {n : len(nums)if n < 2 {return}minVal : min(nums...)maxVal : max(nums...)d : max(1, (maxVal-minVal)/(n-1))bucketSize : (maxVal-minVal)/d 1// 存储 (…

aasist-bladedisc 音频反欺骗算法模型

AASIST 论文 参考ASIST: Audio Anti-Spoofing using Integrated Spectro-Temporal Graph Attention Networks https://arxiv.org/pdf/2110.01200.pdf 模型结构 aasist是一种开源的音频反欺诈的模型&#xff0c;主要的模型结构如下所示&#xff1a; 算法原理 环境配置 Dock…