Browse Source

运行监控x维度

lipenghui 1 week ago
parent
commit
cb14efaf19
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/views/pms/device/monitor/TdDeviceInfo.vue

+ 8 - 1
src/views/pms/device/monitor/TdDeviceInfo.vue

@@ -184,7 +184,14 @@ const renderChart = async () => {
     xAxis: {
       type: 'category',
       data: result.value.map(d => dayjs(d.timestamp).format('YYYY-MM-DD HH:mm:ss')),
-      axisLabel: { rotate: 45 },
+      axisLabel: { rotate: 45,
+        interval: function(index, value) {
+          // 将时间字符串转换为分钟数,每60分钟显示一个刻度(1小时)
+          const minutes = dayjs(value).minute();
+          // 只显示整点的刻度(分钟为0)
+          return minutes === 0;
+        }
+      },
       inverse: true,
     },
     yAxis: {