diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts index 0466a698ac..a5478e3e75 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_table.ts @@ -1,4 +1,11 @@ -import { copyString, hexColorToRGBA, isAlphaColor, parseJson, resetRgbOpacity } from '../..//util' +import { + copyString, + hexColorToRGBA, + isAlphaColor, + isTransparent, + parseJson, + resetRgbOpacity +} from '../..//util' import { DEFAULT_BASIC_STYLE, DEFAULT_TABLE_CELL, @@ -547,7 +554,10 @@ export function getConditions(chart: Chart) { return null } const fill = mappingColor(value, defaultBgColor, field, 'backgroundColor') - return fill ? { fill } : null + if (isTransparent(fill)) { + return null + } + return { fill } } }) } diff --git a/core/core-frontend/src/views/chart/components/js/util.ts b/core/core-frontend/src/views/chart/components/js/util.ts index 8573bb2ae4..e189e030d8 100644 --- a/core/core-frontend/src/views/chart/components/js/util.ts +++ b/core/core-frontend/src/views/chart/components/js/util.ts @@ -990,6 +990,30 @@ export function isAlphaColor(color: string): boolean { return false } +export function isTransparent(color: string): boolean { + if (!color?.trim()) { + return true + } + if (color.startsWith('#')) { + const tmp = color.substring(1, color.length) + if (tmp.length === 3 || tmp.length === 6) { + return false + } + if (tmp.length === 8) { + return tmp.substring(6, 8) === '00' + } + } + if (color.startsWith('rgb')) { + const tmp = color.split(',') + if (tmp.length !== 4) { + return false + } + const alpha = tmp[3].substring(0, tmp[3].length - 1) + return alpha.trim() === '0' + } + return false +} + export function convertToAlphaColor(color: string, alpha: number): string { if (!color?.trim()) { return 'rgba(255,255,255,1)'