fix(图表): 热力图纵轴优化

This commit is contained in:
jianneng-fit2cloud
2024-12-03 10:23:13 +08:00
parent d71096e2c3
commit 90fac24bcb
2 changed files with 19 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ import { useI18n } from '@/hooks/web/useI18n'
import { deepCopy } from '@/utils/utils'
import { cloneDeep } from 'lodash-es'
import {
configAxisLabelLengthLimit,
getPadding,
getXAxis,
getYAxis
@@ -38,7 +39,15 @@ export class TableHeatmap extends G2PlotChartView<HeatmapOptions, Heatmap> {
'basic-style-selector': ['colors'],
'label-selector': ['fontSize', 'color'],
'x-axis-selector': ['name', 'color', 'fontSize', 'position', 'axisLabel', 'axisLine'],
'y-axis-selector': ['name', 'color', 'fontSize', 'position', 'axisLabel', 'axisLine'],
'y-axis-selector': [
'name',
'color',
'fontSize',
'position',
'axisLabel',
'axisLine',
'showLengthLimit'
],
'title-selector': [
'title',
'fontSize',
@@ -194,6 +203,7 @@ export class TableHeatmap extends G2PlotChartView<HeatmapOptions, Heatmap> {
}
}
})
configAxisLabelLengthLimit(chart, newChart)
return newChart
}

View File

@@ -1438,8 +1438,11 @@ export function configAxisLabelLengthLimit(chart, plot) {
}
plot.on('axis-label:mouseenter', e => {
const field = e.target.cfg.delegateObject.component.cfg.field
// 不分图表纵轴通过位置判断,左右为纵轴,目前仅热力图
const position = e.target.cfg.delegateObject.component.cfg.position
const isYaxis = position === 'left' || position === 'right'
// 先只处理竖轴
if (field !== 'field' && field !== 'title') {
if (field !== 'field' && field !== 'title' && !isYaxis) {
return
}
const realContent = e.target.attrs.text
@@ -1482,8 +1485,11 @@ export function configAxisLabelLengthLimit(chart, plot) {
})
plot.on('axis-label:mouseleave', e => {
const field = e.target.cfg.delegateObject.component.cfg.field
// 不分图表纵轴通过位置判断,左右为纵轴,目前仅热力图
const position = e.target.cfg.delegateObject.component.cfg.position
const isYaxis = position === 'left' || position === 'right'
// 先只处理竖轴
if (field !== 'field' && field !== 'title') {
if (field !== 'field' && field !== 'title' && !isYaxis) {
return
}
const realContent = e.target.attrs.text