Merge pull request #13581 from dataease/pr@dev-v2@chart-stack-area-fix

fix(图表): 堆叠折线图取消条件样式功能
This commit is contained in:
jianneng-fit2cloud 2024-11-26 19:43:32 +08:00 committed by GitHub
commit 80a6835901
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View File

@ -317,7 +317,6 @@ export class StackArea extends Area {
} }
protected configLabel(chart: Chart, options: AreaOptions): AreaOptions { protected configLabel(chart: Chart, options: AreaOptions): AreaOptions {
const { label: labelAttr, basicStyle } = parseJson(chart.customAttr) const { label: labelAttr, basicStyle } = parseJson(chart.customAttr)
const conditions = getLineConditions(chart)
if (!labelAttr?.show) { if (!labelAttr?.show) {
return { return {
...options, ...options,
@ -341,10 +340,7 @@ export class StackArea extends Area {
fill: labelAttr.color, fill: labelAttr.color,
fontSize: labelAttr.fontSize fontSize: labelAttr.fontSize
}, },
formatter: function (param: Datum, point) { formatter: function (param: Datum) {
point.color =
getLineLabelColorByCondition(conditions, param.value, point._origin.quotaList[0]) ||
labelAttr.color
return valueFormatter(param.value, labelAttr.labelFormatter) return valueFormatter(param.value, labelAttr.labelFormatter)
} }
} }
@ -392,6 +388,8 @@ export class StackArea extends Area {
...this.baseOptions, ...this.baseOptions,
isStack: true isStack: true
} }
delete this.propertyInner.threshold
this.properties = this.properties.filter(item => item !== 'threshold')
this.axis.push('extStack') this.axis.push('extStack')
} }
} }

View File

@ -1346,7 +1346,7 @@ export const TOOLTIP_TPL =
export function getConditions(chart: Chart) { export function getConditions(chart: Chart) {
const { threshold } = parseJson(chart.senior) const { threshold } = parseJson(chart.senior)
const annotations = [] const annotations = []
if (!threshold.enable) return annotations if (!threshold.enable || chart.type === 'area-stack') return annotations
const conditions = threshold.lineThreshold ?? [] const conditions = threshold.lineThreshold ?? []
const yAxisIds = chart.yAxis.map(i => i.id) const yAxisIds = chart.yAxis.map(i => i.id)
for (const field of conditions) { for (const field of conditions) {