当前位置: 首页 > news >正文

echarts 横向柱状图

在这里插入图片描述

<template><div ref="chart" style="height: 100%"></div>
</template><script>
import * as echarts from "echarts";
var cate = ["质量通病1", "质量通病2", "质量通病3", "质量通病4", "质量通病5"];
//数据值,顺序和Y轴的名字一一对应
var barData = [92, 90, 75, 65, 55];
export default {name: "LineChart",props: ["dataList", "xAxisLabel", "yAxisLabel", "legend"],watch: {dataList() {this.initChart();},},mounted() {this.initChart();},methods: {initChart() {const chart = echarts.init(this.$refs.chart);const option = {backgroundColor: "#061740",tooltip: {trigger: "axis",axisPointer: {type: "shadow",},},//图表位置grid: {left: "5%",right: "10%",bottom: "3%",top: "3%",containLabel: true,},//X轴xAxis: {type: "value",axisLine: {show: false,},axisTick: {show: false,},//不显示X轴刻度线和数字splitLine: { show: false },axisLabel: { show: false },},yAxis: {type: "category",data: cate,//升序inverse: true,splitLine: { show: false },axisLine: {show: false,},axisTick: {show: false,},//key和图间距offset: 10,//动画部分animationDuration: 300,animationDurationUpdate: 300,//key文字大小nameTextStyle: {fontSize: 5,},axisLabel: {textStyle: {color: "#F5F5F5", //更改坐标轴文字颜色fontSize: 12, //更改坐标轴文字大小},},},series: [{//柱状图自动排序,排序自动让Y轴名字跟着数据动realtimeSort: true,name: "数量",type: "bar",data: barData,barWidth: 6,barGap: 10,smooth: true,valueAnimation: true,//Y轴数字显示部分label: {normal: {show: true,position: "right",valueAnimation: true,offset: [5, -2],textStyle: {color: "#F5F5F5",fontSize: 13,},formatter: "{c} %",},},itemStyle: {emphasis: {barBorderRadius: 7,},//颜色样式部分normal: {barBorderRadius: 8,color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ offset: 0, color: "rgba(0, 108, 255, 0.5)" },{ offset: 1, color: "rgba(34, 200, 255, 1)" },]),},},},],//动画部分animationDuration: 0,animationDurationUpdate: 3000,animationEasing: "linear",animationEasingUpdate: "linear",};chart.setOption(option);window.addEventListener("resize", () => {chart.resize();});},},
};
</script>
http://www.lryc.cn/news/117985.html

相关文章:

  • Vue3 —— to 全家桶及源码学习
  • (第三篇) ansible-kubeadm在线安装高可以用集群()
  • flutter开发实战-颜色Color与16进制转换
  • Linux(进程地址空间)
  • VLAN监控及常见问题排查
  • PromQL实现Actuator获取的JVM指标的Full GC次数监控
  • 3.正则表达式
  • 【学习FreeRTOS】第3章——FreeRTOS移植及配置文件
  • Java算法_ LRU 缓存(LeetCode_Hot100)
  • Hugging Face 的文本生成和大语言模型的开源生态
  • Docker Compose用法详解
  • 分布式链路追踪概述
  • css中的var函数
  • 第五次作业 运维高级 构建 LVS-DR 集群和配置nginx负载均衡
  • neo4j电影库-关系查询
  • 2020/10-2023/7 Notes
  • 在UOS系统中管理ORACLE数据库
  • 以http_proxy和ajp_proxy方式整合apache和tomcat(动静分离)
  • 【pinia】Pinia入门和基本使用:
  • Linux 文件系统(一)系统目录
  • 『CV学习笔记』Opencv和PIL Image以及base64编码互相转化
  • 行业追踪,2023-08-07
  • CSRF 攻击和 XSS 攻击分别代表什么?如何防范?
  • RabbitMQ: 详解、使用教程和示例
  • redis NOAUTH Authentication required 可能不是密码问题
  • 动态规划解0-1背包问题(超详细理解)
  • 有哪些可能引起前端安全的问题?
  • 【Unity实战100例】用户头像圆形遮罩使用Shader不用Mask组件
  • arm-linux-gnueabihf-g++ gcc编译、优化命令 汇总
  • vmwera中安装的centos8出现ifconfig不可用