Merge pull request #12864 from dataease/pr@dev-v2@chart-fulldisplay-style

style(图表): 标签的全量显示配置优化及符号地图支持标签的全量显示
This commit is contained in:
jianneng-fit2cloud 2024-10-23 18:57:09 +08:00 committed by GitHub
commit 112dad3e78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 17 deletions

View File

@ -449,7 +449,7 @@ const conversionPrecision = [
{ name: t('chart.reserve_two'), value: 2 }
]
const noFullDisplay = computed(() => {
return !['symbolic-map', 'liquid', 'gauge', 'indicator'].includes(props.chart.type)
return !['liquid', 'gauge', 'indicator'].includes(props.chart.type)
})
</script>

View File

@ -408,6 +408,7 @@ export class SymbolicMap extends L7ChartView<Scene, L7Config> {
.color(label.color)
.size(label.fontSize)
.style({
textAllowOverlap: label.fullDisplay,
textAnchor: 'center',
textOffset: [0, 0]
})

View File

@ -130,24 +130,27 @@ export class Pie extends G2PlotChartView<PieOptions, G2Pie> {
}
}
const layout = []
const type =
labelAttr.position === 'inner'
? labelAttr.fullDisplay
? 'limit-in-plot'
: 'custom-layout'
: labelAttr.fullDisplay
? 'hide-overlap'
: 'limit-in-plot'
if (type === 'custom-layout') {
const tmpOptions = super.configLabel(chart, options)
layout.push({ type: 'limit-in-plot' })
layout.push(...tmpOptions.label.layout)
let textAlign = undefined
if (labelAttr.position === 'inner') {
textAlign = 'center'
if (labelAttr.fullDisplay) {
layout.push({ type: 'limit-in-plot' })
} else {
layout.push({ type: 'limit-in-canvas' })
layout.push({ type: 'hide-overlap' })
}
} else {
layout.push({ type })
if (!labelAttr.fullDisplay) {
layout.push({ type: 'limit-in-plot' })
}
}
let labelType = labelAttr.position === 'outer' ? 'spider' : labelAttr.position
if (layout.length === 0) {
labelType = 'no'
}
const label = {
type: labelAttr.position === 'outer' ? 'spider' : labelAttr.position,
type: labelType,
textAlign,
layout,
autoRotate: false,
style: {

View File

@ -157,7 +157,14 @@ export function getLabel(chart: Chart) {
layout.push({ type: 'interval-hide-overlap' })
} else if (
chart.type.indexOf('-horizontal') > -1 ||
['bidirectional-bar', 'progress-bar', 'pie', 'pie-donut', 'radar'].includes(chart.type)
[
'bidirectional-bar',
'progress-bar',
'pie-donut',
'radar',
'waterfall',
't-heatmap'
].includes(chart.type)
) {
layout.push({ type: 'hide-overlap' })
} else {