折线图坐标文本间距过近
This commit is contained in:
parent
091a84294f
commit
e0f2bb743b
|
|
@ -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 + '<br>';
|
||||
});
|
||||
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),
|
||||
|
|
|
|||
3
types/auto-imports.d.ts
vendored
3
types/auto-imports.d.ts
vendored
|
|
@ -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')
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user