From e0f2bb743bac055aecefae8f6b842ef10d1a7d35 Mon Sep 17 00:00:00 2001 From: chenjiancheng <431909623@qq.com> Date: Mon, 24 Feb 2025 16:13:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=98=E7=BA=BF=E5=9B=BE=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E9=97=B4=E8=B7=9D=E8=BF=87=E8=BF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/rightModule/index.vue | 26 ++++++++++++------- types/auto-imports.d.ts | 3 +-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/pages/calculateCenter/base/rightModule/index.vue b/src/pages/calculateCenter/base/rightModule/index.vue index d1033e5..43ebcfd 100644 --- a/src/pages/calculateCenter/base/rightModule/index.vue +++ b/src/pages/calculateCenter/base/rightModule/index.vue @@ -319,6 +319,17 @@ const handleEchartData = (res) => { const chartStatus = ref(0); const datasetOption = { + tooltip: { + trigger: 'axis', + formatter: function (params) { + // 当鼠标悬浮在 X 轴标签上时,显示完整的文本 + let tooltipText = ''; + params.forEach(item => { + tooltipText += item.name + ': ' + item.value + '
'; + }); + return tooltipText; + } + }, xAxis: { type: 'category', data: [ @@ -334,6 +345,7 @@ const datasetOption = { axisLine: { show: true, }, + axisLabel: { show: true, interval: 0, @@ -342,16 +354,12 @@ const datasetOption = { formatter(str) { const contentLength = str.length; let result; + if (contentLength > 6) { + result = `${str.slice(0, 3)}\n${str.slice(3,5)}...`; + } else { result = `${str.slice(0, contentLength / 2)}\n${str.slice(contentLength / 2)}`; - // if (contentLength === 4) { - // result = `${str.slice(0, 2)}\n${str.slice(2)}`; - // } else if (contentLength === 6) { - // result = `${str.slice(0, 3)}\n${str.slice(3)}`; - // } else if (contentLength === 8) { - // result = `${str.slice(0, 4)}\n${str.slice(4)}`; - // } else if (contentLength === 7) { - // result = `${str.slice(0, 4)}\n${str.slice(4)}`; - // } + + } return result; }, fontSize: nowSize(16), diff --git a/types/auto-imports.d.ts b/types/auto-imports.d.ts index f6e2bab..00e05c3 100644 --- a/types/auto-imports.d.ts +++ b/types/auto-imports.d.ts @@ -3,7 +3,6 @@ // @ts-nocheck // noinspection JSUnusedGlobalSymbols // Generated by unplugin-auto-import -// biome-ignore lint: disable export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] @@ -83,6 +82,6 @@ declare global { // for type re-export declare global { // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' + export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' import('vue') }