折线图坐标文本间距过近
This commit is contained in:
parent
091a84294f
commit
e0f2bb743b
|
|
@ -319,6 +319,17 @@ const handleEchartData = (res) => {
|
||||||
|
|
||||||
const chartStatus = ref(0);
|
const chartStatus = ref(0);
|
||||||
const datasetOption = {
|
const datasetOption = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
formatter: function (params) {
|
||||||
|
// 当鼠标悬浮在 X 轴标签上时,显示完整的文本
|
||||||
|
let tooltipText = '';
|
||||||
|
params.forEach(item => {
|
||||||
|
tooltipText += item.name + ': ' + item.value + '<br>';
|
||||||
|
});
|
||||||
|
return tooltipText;
|
||||||
|
}
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: [
|
data: [
|
||||||
|
|
@ -334,6 +345,7 @@ const datasetOption = {
|
||||||
axisLine: {
|
axisLine: {
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
show: true,
|
show: true,
|
||||||
interval: 0,
|
interval: 0,
|
||||||
|
|
@ -342,16 +354,12 @@ const datasetOption = {
|
||||||
formatter(str) {
|
formatter(str) {
|
||||||
const contentLength = str.length;
|
const contentLength = str.length;
|
||||||
let result;
|
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)}`;
|
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;
|
return result;
|
||||||
},
|
},
|
||||||
fontSize: nowSize(16),
|
fontSize: nowSize(16),
|
||||||
|
|
|
||||||
3
types/auto-imports.d.ts
vendored
3
types/auto-imports.d.ts
vendored
|
|
@ -3,7 +3,6 @@
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
// Generated by unplugin-auto-import
|
// Generated by unplugin-auto-import
|
||||||
// biome-ignore lint: disable
|
|
||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
const EffectScope: typeof import('vue')['EffectScope']
|
const EffectScope: typeof import('vue')['EffectScope']
|
||||||
|
|
@ -83,6 +82,6 @@ declare global {
|
||||||
// for type re-export
|
// for type re-export
|
||||||
declare global {
|
declare global {
|
||||||
// @ts-ignore
|
// @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')
|
import('vue')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user