diff --git a/packages/graphic-walker/src/lib/vega.ts b/packages/graphic-walker/src/lib/vega.ts index b22ee8b9..f581ed01 100644 --- a/packages/graphic-walker/src/lib/vega.ts +++ b/packages/graphic-walker/src/lib/vega.ts @@ -103,8 +103,8 @@ export function toVegaSpec({ } else { const rowNums = rowFacetField !== NULL_FIELD ? new Set(dataSource.map((x) => x[rowFacetField.fid])).size : 1; const colNums = colFacetField !== NULL_FIELD ? new Set(dataSource.map((x) => x[colFacetField.fid])).size : 1; - spec.width = Math.floor((width - (rowFacetField === NULL_FIELD ? 40 : 94)) / colNums - 23); - spec.height = Math.floor((height - (colFacetField === NULL_FIELD ? 24 : 94)) / rowNums - 23); + spec.width = Math.floor(width / colNums); + spec.height = Math.floor(height / rowNums); } const v = getSingleView({ @@ -127,7 +127,7 @@ export function toVegaSpec({ geomType, displayOffset, dataSource, - vegaConfig + vegaConfig, }); const singleView = scales ? resolveScales(scales, v, dataSource, mediaTheme) : v; @@ -160,8 +160,8 @@ export function toVegaSpec({ } else { const rowNums = rowFacetField !== NULL_FIELD ? new Set(dataSource.map((x) => x[rowFacetField.fid])).size : 1; const colNums = colFacetField !== NULL_FIELD ? new Set(dataSource.map((x) => x[colFacetField.fid])).size : 1; - spec.width = Math.floor((width / colRepeatFields.length - (rowFacetField === NULL_FIELD ? 40 : 94)) / colNums - 23); - spec.height = Math.floor((height / rowRepeatFields.length - (colFacetField === NULL_FIELD ? 24 : 94)) / rowNums - 23); + spec.width = Math.floor(width / colRepeatFields.length / colNums); + spec.height = Math.floor(height / rowRepeatFields.length / rowNums); } let index = 0; diff --git a/packages/graphic-walker/src/renderer/specRenderer.tsx b/packages/graphic-walker/src/renderer/specRenderer.tsx index 2a85652c..e4eaaf36 100644 --- a/packages/graphic-walker/src/renderer/specRenderer.tsx +++ b/packages/graphic-walker/src/renderer/specRenderer.tsx @@ -74,14 +74,9 @@ const SpecRenderer = forwardRef(function ( const text = draggableFieldState.text; const format = _format; - const rowLeftFacetFields = useMemo(() => rows.slice(0, -1).filter((f) => f.analyticType === 'dimension'), [rows]); - const colLeftFacetFields = useMemo(() => columns.slice(0, -1).filter((f) => f.analyticType === 'dimension'), [columns]); - const isPivotTable = geoms[0] === 'table'; - const hasFacet = rowLeftFacetFields.length > 0 || colLeftFacetFields.length > 0; - - const enableResize = size.mode === 'fixed' && !hasFacet && Boolean(onChartResize); + const enableResize = size.mode === 'fixed' && Boolean(onChartResize); const mediaTheme = useContext(themeContext); const uiTheme = useContext(uiThemeContext); const themeConfig = getTheme({ diff --git a/packages/graphic-walker/src/vis/react-vega.tsx b/packages/graphic-walker/src/vis/react-vega.tsx index b1704972..59454439 100644 --- a/packages/graphic-walker/src/vis/react-vega.tsx +++ b/packages/graphic-walker/src/vis/react-vega.tsx @@ -417,7 +417,6 @@ const ReactVega = forwardRef(function ReactVe }; if (res.view.width() === 0) { if (res.view.signal('child_width') !== undefined) { - // is faceted view res.view.signal( 'child_width', specs[0].width - modifier.width / Math.round((areaWidth || width) / colRepeatFields.length / specs[0].width) @@ -527,7 +526,7 @@ const ReactVega = forwardRef(function ReactVe
(function ReactVe > {/*
*/} {viewPlaceholders.map((view, i) => ( -
+
))}