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') }