Merge pull request #12700 from dataease/pr@dev-v2@refactor_group_stack_bar_sum_label

refactor(图表): 分组堆叠柱状图去除总计标签
This commit is contained in:
wisonic-s 2024-10-14 19:32:29 +08:00 committed by GitHub
commit f541817c2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -436,10 +436,11 @@ export class GroupBar extends StackBar {
} }
protected configLabel(chart: Chart, options: ColumnOptions): ColumnOptions { protected configLabel(chart: Chart, options: ColumnOptions): ColumnOptions {
const baseOptions = super.configLabel(chart, options) const tmpLabel = getLabel(chart)
if (!baseOptions.label) { if (!tmpLabel) {
return baseOptions return options
} }
const baseOptions = { ...options, label: tmpLabel }
const { label: labelAttr } = parseJson(chart.customAttr) const { label: labelAttr } = parseJson(chart.customAttr)
baseOptions.label.style.fill = labelAttr.color baseOptions.label.style.fill = labelAttr.color
const label = { const label = {
@ -517,10 +518,11 @@ export class GroupStackBar extends StackBar {
} }
protected configLabel(chart: Chart, options: ColumnOptions): ColumnOptions { protected configLabel(chart: Chart, options: ColumnOptions): ColumnOptions {
const baseOptions = super.configLabel(chart, options) const tmpLabel = getLabel(chart)
if (!baseOptions.label) { if (!tmpLabel) {
return baseOptions return options
} }
const baseOptions = { ...options, label: tmpLabel }
const { label: labelAttr } = parseJson(chart.customAttr) const { label: labelAttr } = parseJson(chart.customAttr)
baseOptions.label.style.fill = labelAttr.color baseOptions.label.style.fill = labelAttr.color
const label = { const label = {