diff --git a/frontend/src/adapters/gateways/EChartsOptionBuilder/wordcloudOptionBuilder.ts b/frontend/src/adapters/gateways/EChartsOptionBuilder/wordcloudOptionBuilder.ts index c1fd453..d7a617e 100644 --- a/frontend/src/adapters/gateways/EChartsOptionBuilder/wordcloudOptionBuilder.ts +++ b/frontend/src/adapters/gateways/EChartsOptionBuilder/wordcloudOptionBuilder.ts @@ -272,8 +272,11 @@ export function buildWordcloudOption( data: wordData, }; - // Always set maskImage explicitly — undefined clears previous mask - series.maskImage = maskImage ?? undefined; + if (maskImage) { + series.maskImage = maskImage; + } + // For rectangle: no maskImage, no shape — pure default fills the container + // For other shapes with mask: maskImage handles the shape option.series = [series]; return option; diff --git a/frontend/src/frameworks/components/charts/ChartRenderer.tsx b/frontend/src/frameworks/components/charts/ChartRenderer.tsx index 8fe765b..e690e11 100644 --- a/frontend/src/frameworks/components/charts/ChartRenderer.tsx +++ b/frontend/src/frameworks/components/charts/ChartRenderer.tsx @@ -38,9 +38,11 @@ export const ChartRenderer: React.FC = ({ chart, data, chart default: const borderRadius = chart.style?.background?.borderRadius ?? 0; const overflow = borderRadius > 0 ? 'hidden' as const : undefined; - // Force re-mount when wordcloud shape changes (plugin caches mask internally) - const wcShape = (chart.style as any)?.wordcloud?.shape ?? 'default'; - const echartsKey = chart.type === 'wordcloud' ? `${chartId}-${wcShape}` : chartId; + // Force re-mount when wordcloud config changes (plugin caches mask internally) + const wcConfig = (chart.style as any)?.wordcloud; + const echartsKey = chart.type === 'wordcloud' && wcConfig + ? `${chartId}-${wcConfig.shape}-${wcConfig.sizeMin}-${wcConfig.sizeMax}-${wcConfig.gridSize}-${wcConfig.customImageUrl ? 'img' : 'no'}` + : chartId; return echartsOption ? :
请绑定数据字段
;