vue+echarts实现雷达图及刻度标注

news/2024/10/18 14:25:42/

文章目录

  • 前言
  • 代码实现
  • 实现效果
  • 总结


前言

最近项目有做数据可视化 大屏 不免再次使用些echarts应用 记录下其中echarts雷达图的实现


代码实现

先上代码

<template><div class="container"><div ref="chart" style="width: 500px; height: 500px; margin-top: 20px"></div></div>
</template><script>
export default {name: 'testDemo',data() {return {};},methods: {initChart() {this.chart = this.$echarts.init(this.$refs.chart);const option = {color: ['#FFC481', '#8EC6F8', '#56D8CD'],title: {x: 'center',y: 'center',textStyle: {fontSize: 12,rich: {a: {color: '#0066FF',fontSize: 18,align: 'center',},b: {color: '#00BBFF',fontSize: 12,height: 16,align: 'centerc',},c: {color: 'orange',fontSize: 12,height: 16,align: 'center',},},},},// 配置图例legend: {},radar: {indicator: [{name: '资本背景', max: 100, min: 0, index: 0, axisLabel: {show: true}}, //显示刻度{name: '知识产权', max: 100, min: 0, index: 1},{name: '成长性', max: 100, min: 0, index: 2},{name: '风险状况', max: 100, min: 0, index: 3},{name: '经营质量', max: 100, min: 0, index: 4},{name: '企业规模', max: 100, min: 0, index: 5},],radius: 80, //大小startAngle: 120, // 雷达图的旋转偏移量splitNumber: 5, // 分层5层,当前最大1000,可理解为每层200triggerEvent: true,name: {formatter: (value, indicator) => {// 获取对应的数值const valueAtIndex = this.radarData[indicator.index];return `{a|${value}}: {b|${valueAtIndex}}`; // 显示名称和对应的数值},rich: {a: {color: '#333',fontSize: 12,},b: {color: '#333',fontSize: 12,},},},},textStyle: {color: '#333333',},series: [{type: 'radar',areaStyle: {normal: {//添加阴影效果的配置部分color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 0, color: 'rgba(255, 196, 129, 0.8)'},{offset: 1, color: 'rgba(255, 196, 129, 0.3)'},]),opacity: 0.8,},},data: [{value: [34,23,34,87,68,67],},],},],};this.chart.setOption(option);}},mounted() {// 等dom渲染后再初始化图表this.initChart()}
};
</script><style scoped>
</style>

实现效果

在这里插入图片描述


总结

initChart方法中,使用this.$echarts.init来初始化一个ECharts实例,并设置图表的配置项option。这些配置项定义了图表的标题、提示框、雷达图的指标、名称的富文本样式、全局文本样式以及系列列表等。最后,通过this.chart.setOption(option)将配置项应用到图表实例上


http://www.ppmy.cn/news/1538539.html

相关文章

帮助,有奖提问

<?php $u $_GET[“user”]; //变量获取 $v $_GET[“variable”]; //$v看flag&#xff0c;绕过正则 $flag‘flag{}; if(isset($u)&&(file_get_contents($u,‘r’)“im admin”)){//猜测data://协议 //检查u指向 echo “hello admin!<br>”; if(preg_…

OpenCV透视变换

#透视变换 import cv2 import numpy as np import matplotlib.pyplot as pltimg cv2.imread(coins.jpg,1)imgInfo img.shape height imgInfo[0] width imgInfo[1] #src 4->dst 4 (左上角 左下角 右上角 右下角) matSrc np.float32([[200,100],[200,400],[600,100],[wid…

标准正态分布的数据 tensorflow 实现正态分布图,python 编程,数据分析和人工智能

import tensorflow as tf import matplotlib.pyplot as plt # 设置随机种子以获得可重复的结果 tf.random.set_seed(42) # 生成正态分布的数据 # mean0 和 stddev1 表示生成标准正态分布的数据 # shape(1000,) 表示生成1000个数据点 data tf.random.normal(mean0, stddev1, …

OCR+PDF解析配套前端工具开源详解!

目录 一、项目简介 TextIn为相关领域的前端开发提供了优秀的范本。 目前项目已在Github上开源&#xff01; 二、性能特色 三、安装使用 安装依赖启动项目脚本命令项目结构 四、效果展示 面对日常生活和工作中常见的OCR识别、PDF解析、翻译、校对等场景&#xff0c;配套的…

STM32 ADC学习日记

STM32 ADC学习日记 1. ADC简介 ADC 即模拟数字转换器&#xff0c;英文详称 Analog-to-digital converter&#xff0c;可以将外部的模拟信号转换为数字信号。 STM32F103 系列芯片拥有 3 个 ADC&#xff08;C8T6 只有 2 个&#xff09;&#xff0c;这些 ADC 可以独立使用&…

案例-任务清单

文章目录 效果展示初始化面演示画面 代码区 效果展示 初始化面 演示画面 任务清单 代码区 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, in…

Vue前端框架的基础配置

登录界面添加背景图 通过在登录界面的vue文件中&#xff0c;设置div标签的background-image属性&#xff0c;加载背景图 <style scoped> .myvue{width:100%;height: 750px; //添加背景图的地址background-image: url(../assets/oa.jpeg);background-size: cover;backgr…

OpenCVSharp使用DNN图像分类详解

文章目录 简介1. DNN 模块概述2. 环境准备3. 加载模型4. 预处理输入图像5. 进行推理6. 解析输出结果7. 处理不同框架的模型8. 完整示例代码总结简介 OpenCV 的 DNN(深度神经网络)模块提供了加载和运行深度学习模型的能力,使得图像分类变得更为简单。通过 OpenCVSharp,我们可…