From fd282f4783bd42874dafa03ca867406642231fae Mon Sep 17 00:00:00 2001 From: zhangzhang <1747194829@qq.com> Date: Thu, 25 Apr 2024 11:02:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=9C=A8=E7=BA=BF=E7=8E=87?= =?UTF-8?q?=E6=9F=B1=E7=8A=B6=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onLineBarCharts/assets/barCharts.js | 162 ++++++++++++++++++ .../components/onLineBarCharts/index.vue | 144 ++++++++++++++++ .../statisticalAnalysis/index.vue | 6 +- 3 files changed, 311 insertions(+), 1 deletion(-) create mode 100644 ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/assets/barCharts.js create mode 100644 ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/index.vue diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/assets/barCharts.js b/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/assets/barCharts.js new file mode 100644 index 00000000..85a7a74c --- /dev/null +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/assets/barCharts.js @@ -0,0 +1,162 @@ +/* 数据 */ +let nameList = [ + "1月", + "2月", + "3月", + "4月", + "5月", + "6月", + "7月", + "8月", + "9月", + "10月", + "11月", + "12月", +]; // 类别 +let valueList = [ + 800, 520, 650, 950, 420, 600, 450, 720, 303, 503, 203, 703, 903, +]; // 人数 +// var yList = ["1000", "800", "轻度拥堵", "基本畅通", "畅通"] +/* 数据整合 */ +let dataList = []; +nameList.map((item, index) => { + if (index === 4) { + dataList.push({ + name: item, + value: valueList[index], + itemStyle: { + color: { + type: "linear", + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { + offset: 0, + color: "#FFB904", // 0% 处的颜色 + }, + { + offset: 1, + color: "#FF6969", // 100% 处的颜色 + }, + ], + global: false, // 缺省为 false + }, + borderRadius: 6, + }, + label: { show: false }, + }); + } else { + dataList.push({ + name: item, + value: valueList[index], + itemStyle: { + borderRadius: 6, + }, + }); + } +}); + +var options = { + grid: { + top: "15%", //上边距 + right: "5px", //右边距 + left: "30px", //左边距 + bottom: "2%", //下边距 + containLabel: true, + }, + tooltip: { + valueFormatter: function (value) { + return value + " %"; + }, + }, + xAxis: { + type: "category", + data: nameList, + axisTick: { + show: false, //隐藏X轴刻度 + }, + axisLine: { + lineStyle: { + color: "rgba(49, 217, 255, 0.8)", + }, + }, + axisLabel: { + show: true, + color: "#fff", + fontSize: "10px", + fontFamily: "Source Han Sans CN-Regular", + interval: 0, + rotate: 20, + }, + }, + yAxis: [ + { + type: "value", + name: "(%)", + splitNumber: 5, + nameTextStyle: { + color: "#fff", + fontSize: 10, + align: "right", + // fontFamily: "Source Han Sans CN-Regular", + // align: "left", + // verticalAlign: "center", + }, + axisLabel: { + fontSize: "10px", + color: "#fff", + fontFamily: "HarmonyOS Sans-Regular", + // formatter:function(value,index){ + // return yList[index] + // } + }, + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + splitLine: { + lineStyle: { + color: "rgba(49, 217, 255, 0.5)", + }, + }, + }, + ], + series: [ + { + type: "bar", + data: [10, 20, 10, 30, 25, 11, 20], + z: 4, + itemStyle: { + color: { + type: "linear", + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [ + { + offset: 0, + color: "#06D7B1", // 0% 处的颜色 + }, + { + offset: 1, + color: "#80F1BB", // 100% 处的颜色 + }, + ], + global: false, // 缺省为 false + }, + borderRadius: [4, 4, 0, 0], + }, + barWidth: 10, + label: { + show: false, + }, + }, + ], +}; + +export default options; diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/index.vue new file mode 100644 index 00000000..a549ecb2 --- /dev/null +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/components/onLineBarCharts/index.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/index.vue index b68458be..60fa0f77 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/index.vue +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/maintenanceOperations/statisticalAnalysis/index.vue @@ -8,7 +8,8 @@ >
- + +
@@ -117,7 +118,9 @@