diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue index 72ddc99d48..1ed851d5bc 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/LabelSelector.vue @@ -292,7 +292,7 @@ const configCompat = (labelAttr: DeepPartial) => { } } const checkLabelContent = contentProp => { - if (chartType.value === 'funnel' || chartType.value === 'liquid') { + if (['funnel', 'liquid', 'circle-packing'].includes(chartType.value)) { return false } const propIntersection = intersection(props.propertyInner, [ diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/circle-packing.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/circle-packing.ts index eceae28453..96ebc802a7 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/circle-packing.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/circle-packing.ts @@ -47,7 +47,7 @@ export class CirclePacking extends G2PlotChartView { - return d.children.length === 0 ? d.name : '' + let showLabel = labelAttr.showDimension ? d.name : '' + if (labelAttr.showQuota) { + const quota = valueFormatter(d.value, labelAttr.quotaLabelFormatter) + showLabel += showLabel ? `\n${quota}` : quota + } + if (labelAttr.showProportion && d.depth > 0) { + const proportion = ((d.value || 1) / (d.parent?.value || 1)) * 100 + const percent = `${proportion.toFixed(labelAttr.reserveDecimalCount ?? 2)}%` + showLabel += showLabel ? `\n${percent}` : percent + } + return d.children.length === 0 ? showLabel : '' } } return {