fix(图表-对称条形图): 修复标签位置默认值是left或者right的问题

This commit is contained in:
jianneng-fit2cloud 2024-07-29 10:24:35 +08:00
parent 7394264228
commit 06bfc4457e

View File

@ -262,23 +262,25 @@ watch(
() => props.chart.customAttr.basicStyle.layout, () => props.chart.customAttr.basicStyle.layout,
() => { () => {
const layout = props.chart.customAttr.basicStyle.layout const layout = props.chart.customAttr.basicStyle.layout
if (layout === 'horizontal') { if (chartType.value === 'bidirectional-bar') {
if (state?.labelForm?.position === 'top') { if (layout === 'horizontal') {
state.labelForm.position = 'right' if (state?.labelForm?.position === 'top') {
state.labelForm.position = 'right'
}
if (state?.labelForm?.position === 'bottom') {
state.labelForm.position = 'left'
}
} }
if (state?.labelForm?.position === 'bottom') { if (layout === 'vertical') {
state.labelForm.position = 'left' if (state?.labelForm?.position === 'left') {
state.labelForm.position = 'bottom'
}
if (state?.labelForm?.position === 'right') {
state.labelForm.position = 'top'
}
} }
changeLabelAttr('position')
} }
if (layout === 'vertical') {
if (state?.labelForm?.position === 'left') {
state.labelForm.position = 'bottom'
}
if (state?.labelForm?.position === 'right') {
state.labelForm.position = 'top'
}
}
changeLabelAttr('position')
}, },
{ deep: true } { deep: true }
) )