diff --git a/patches/victory-native/details.md b/patches/victory-native/details.md index ad919a91a15c..84c369411886 100644 --- a/patches/victory-native/details.md +++ b/patches/victory-native/details.md @@ -11,19 +11,3 @@ - Upstream PR/issue: Not yet. This is urgent patch with deadline. - E/App issue: https://github.com/Expensify/App/issues/91883 - PR introducing patch: https://github.com/Expensify/App/pull/91659 - - -### [victory-native+42.0.1+002+tickCount-4121.patch](victory-native+42.0.1+002+tickCount-4121.patch) - -- Reason: - - ``` - After updating to v42 the tickCount broke. - This was caused by this commit https://github.com/FormidableLabs/victory-native-xl/pull/664/changes/fcd8affe655878d0bf95ab87c087eab428d4f62d - which fixed some bug but caused us another bug. This small patch reverts it. This is a temporary solution not a real fix. - The fix should address both bugs. - ``` - -- Upstream PR/issue: Not yet. -- E/App issue: https://github.com/Expensify/App/issues/91883 -- PR introducing patch: https://github.com/Expensify/App/pull/100186 diff --git a/patches/victory-native/victory-native+42.0.1+002+tickCount-4121.patch b/patches/victory-native/victory-native+42.0.1+002+tickCount-4121.patch deleted file mode 100644 index 2df5629281c1..000000000000 --- a/patches/victory-native/victory-native+42.0.1+002+tickCount-4121.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/victory-native/src/utils/tickHelpers.ts b/node_modules/victory-native/src/utils/tickHelpers.ts -index 100fb89..ea9fdca 100644 ---- a/node_modules/victory-native/src/utils/tickHelpers.ts -+++ b/node_modules/victory-native/src/utils/tickHelpers.ts -@@ -17,7 +17,7 @@ export const downsampleTicks = (tickValues: number[], tickCount: number) => { - } - - if (tickCount <= 0) { -- return []; -+ return tickValues; - } - - if (!Array.isArray(tickValues) || tickValues.length <= tickCount) { diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx index 26b685a6309f..6cbbd9d5b951 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx @@ -44,7 +44,7 @@ type VictoryChartProviderProps = { /** Supplies parsed chart config to chart sub-components. Callers must parse and validate the tnode first. */ function VictoryChartProvider({tnode, processedResult, type, children}: VictoryChartProviderProps) { - const {data, xKey, yKeys, xAxis, yAxis, domain, domainPadding, padding, isHorizontal, categories, labelItems, legendItems, pointMetadata} = processedResult; + const {data, xKey, yKeys, xAxis, yAxis, domain, domainPadding, designPadding, padding, isHorizontal, categories, labelItems, legendItems, pointMetadata} = processedResult; const {nodeStyles: chartContentStyles, parentNodeStyles: chartContainerStyles} = parseStyles(tnode); const parsedDesignHeight = typeof chartContentStyles.height === 'number' ? chartContentStyles.height : undefined; const itemCount = categories?.length ?? Object.keys(data).length; @@ -52,7 +52,7 @@ function VictoryChartProvider({tnode, processedResult, type, children}: VictoryC designHeight: parsedDesignHeight, isHorizontal, itemCount, - padding, + designPadding, }); const heightDelta = parsedDesignHeight !== undefined && effectiveChartHeight !== undefined ? parsedDesignHeight - effectiveChartHeight : 0; const effectiveChartContentStyles = heightDelta > 0 ? {...chartContentStyles, height: effectiveChartHeight} : chartContentStyles; diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/processVictoryChartTree.ts b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/processVictoryChartTree.ts index 8d44f9b7f822..0f7628b34efc 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/processVictoryChartTree.ts +++ b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/processVictoryChartTree.ts @@ -21,7 +21,10 @@ function processVictoryChartTree(tnode: TNode, typeface: SkTypeface | null, root let domain: ProcessNodeResult['domain']; let domainPadding: ProcessNodeResult['domainPadding']; let padding: ProcessNodeResult['padding']; - let leftAxisLabelPadding: ProcessNodeResult['leftAxisLabelPadding']; + let leftAxisSize: ProcessNodeResult['leftAxisSize']; + let rightAxisSize: ProcessNodeResult['rightAxisSize']; + let bottomAxisSize: ProcessNodeResult['bottomAxisSize']; + let topAxisSize: ProcessNodeResult['topAxisSize']; let isHorizontal: ProcessNodeResult['isHorizontal']; let categories: ProcessNodeResult['categories']; const labelItems: ProcessNodeResult['labelItems'] = []; @@ -52,8 +55,17 @@ function processVictoryChartTree(tnode: TNode, typeface: SkTypeface | null, root if (result.padding) { padding = result.padding; } - if (result.leftAxisLabelPadding !== undefined) { - leftAxisLabelPadding = result.leftAxisLabelPadding; + if (result.leftAxisSize !== undefined) { + leftAxisSize = result.leftAxisSize; + } + if (result.rightAxisSize !== undefined) { + rightAxisSize = result.rightAxisSize; + } + if (result.bottomAxisSize !== undefined) { + bottomAxisSize = result.bottomAxisSize; + } + if (result.topAxisSize !== undefined) { + topAxisSize = result.topAxisSize; } if (result.isHorizontal) { isHorizontal = result.isHorizontal; @@ -81,8 +93,12 @@ function processVictoryChartTree(tnode: TNode, typeface: SkTypeface | null, root yAxis, domain, domainPadding, + designPadding: padding, padding, - leftAxisLabelPadding, + leftAxisSize, + rightAxisSize, + bottomAxisSize, + topAxisSize, isHorizontal, categories, labelItems, @@ -109,8 +125,17 @@ function processVictoryChartTree(tnode: TNode, typeface: SkTypeface | null, root if (childResult.padding) { padding = childResult.padding; } - if (childResult.leftAxisLabelPadding !== undefined) { - leftAxisLabelPadding = childResult.leftAxisLabelPadding; + if (childResult.leftAxisSize !== undefined) { + leftAxisSize = childResult.leftAxisSize; + } + if (childResult.rightAxisSize !== undefined) { + rightAxisSize = childResult.rightAxisSize; + } + if (childResult.bottomAxisSize !== undefined) { + bottomAxisSize = childResult.bottomAxisSize; + } + if (childResult.topAxisSize !== undefined) { + topAxisSize = childResult.topAxisSize; } if (childResult.isHorizontal) { isHorizontal = childResult.isHorizontal; @@ -131,8 +156,12 @@ function processVictoryChartTree(tnode: TNode, typeface: SkTypeface | null, root yAxis, domain, domainPadding, - padding: resolvePadding(padding, leftAxisLabelPadding), - leftAxisLabelPadding, + designPadding: padding, + padding: resolvePadding(padding, xAxis, yAxis, leftAxisSize, rightAxisSize, bottomAxisSize, topAxisSize, isHorizontal), + leftAxisSize, + rightAxisSize, + bottomAxisSize, + topAxisSize, isHorizontal, categories, labelItems, diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/victoryAxisParser.ts b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/victoryAxisParser.ts index 6a5ee01533d9..a488170ca528 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/victoryAxisParser.ts +++ b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/parsers/victoryAxisParser.ts @@ -1,5 +1,5 @@ import {LEFT_AXIS_LABEL_OFFSET_MAX} from '@components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/constants'; -import type {PartialProcessNodeResult, ProcessNodeResult} from '@components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/types'; +import type {CartesianChartProps, PartialProcessNodeResult, ProcessNodeResult} from '@components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/types'; import getFontGlyphWidth from '@components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/getFontGlyphWidth'; import { parseAttributeAsNumber, @@ -11,20 +11,26 @@ import parseRawAxisStyle from '@components/HTMLEngineProvider/HTMLRenderers/Vict import type {SkFont, SkTypeface} from '@shopify/react-native-skia'; import type {TNode} from 'react-native-render-html'; +import type {XAxisSide, YAxisSide} from 'victory-native'; import {Skia} from '@shopify/react-native-skia'; /** - * The widest rendered label on a left-side y-axis, plus its offset from the axis line — - * i.e. how much horizontal space the axis actually needs for its labels. Used to shrink - * the chart's `padding.left` when the configured value is more than the content needs. + * For y-axis this returns the widest rendered label plus its offset from the axis line + * For x-axis this returns the label line height plus its offset from the axis line */ -function computeLeftAxisLabelPadding(axisSide: 'left' | 'right', labels: Array | undefined, font: SkFont | null, labelOffset: number | undefined): number | undefined { - if (axisSide !== 'left' || !font || !labels?.length) { +function computeAxisSize(axisSide: XAxisSide | YAxisSide, labels: Array | undefined, font: SkFont | null, labelOffset: number | undefined): number | undefined { + if (!font || !labels?.length) { return undefined; } + if (axisSide === 'bottom' || axisSide === 'top') { + // victory-native uses the font size as the line height + // https://github.com/FormidableLabs/victory-native-xl/blob/de84ff1f3098a2072f8c52ac801ce08141fdb46a/lib/src/utils/textLayout.ts#L18-L42 + const lineHeight = font.getSize(); + return Math.ceil(lineHeight + 2 * (labelOffset ?? 0)); + } const maxLabelWidth = Math.max(...labels.map((label) => getFontGlyphWidth(String(label), font))); - return maxLabelWidth + (labelOffset ?? 0); + return Math.ceil(maxLabelWidth + (labelOffset ?? 0)); } /** @@ -35,9 +41,9 @@ function parseVictoryAxisNode(tnode: TNode, typeface: SkTypeface | null, rootPro const isHorizontal = rootProcessedResult?.isHorizontal; const isDependentAxis = 'dependentaxis' in tnode.attributes && tnode.attributes.dependentaxis !== 'false'; const orientation = parseAttributeAsString(tnode.attributes.orientation); - const tickCount = parseAttributeAsNumber(tnode.attributes.tickcount) ?? 0; const rawTickValues = parseAttributeAsNumberArray(tnode.attributes.tickvalues); const tickValues = Array.isArray(rawTickValues) ? rawTickValues : undefined; + const tickCount = parseAttributeAsNumber(tnode.attributes.tickcount) ?? tickValues?.length ?? 0; const rawTickFormat = parseAttributeAsStringArray(tnode.attributes.tickformat); const tickFormat = Array.isArray(rawTickFormat) ? rawTickFormat : undefined; const formatLabel = (label: string | number) => tickFormat?.[tickValues?.indexOf(Number(label)) ?? -1] ?? String(label); @@ -46,74 +52,112 @@ function parseVictoryAxisNode(tnode: TNode, typeface: SkTypeface | null, rootPro // 0 width intentionally avoids drawing grid lines, preserving VictoryChart compatibility const lineWidth = style?.grid?.strokeWidth !== undefined ? Number(style.grid.strokeWidth) : 0; const labelColor = style?.tickLabels?.fill !== undefined ? String(style.tickLabels.fill) : undefined; - const labelOffset = style?.tickLabels?.padding !== undefined ? Number(style.tickLabels.padding) : undefined; const fontSize = style?.tickLabels?.fontSize !== undefined ? Number(style.tickLabels.fontSize) : undefined; const font = typeface && fontSize ? Skia.Font(typeface, fontSize) : null; const labelsForMeasurement = tickValues?.map(formatLabel) ?? tickFormat; + const rawLabelOffset = style?.tickLabels?.padding !== undefined ? Number(style.tickLabels.padding) : undefined; - if (isDependentAxis) { - return isHorizontal - ? { - xAxis: { - tickCount, - tickValues, - formatXLabel: formatLabel, - axisSide: orientation === 'right' ? 'top' : 'bottom', - lineColor, - lineWidth, - labelColor, - labelOffset, - font, - }, - } - : { - yAxis: [ - { - tickCount, - tickValues, - formatYLabel: formatLabel, - axisSide: orientation === 'right' ? 'right' : 'left', - lineColor, - lineWidth, - labelColor, - labelOffset, - font, - }, - ], - }; - } - if (isHorizontal) { - const axisSide = orientation === 'top' ? 'right' : 'left'; - const resolvedLabelOffset = axisSide === 'left' && labelOffset !== undefined ? Math.min(labelOffset, LEFT_AXIS_LABEL_OFFSET_MAX) : labelOffset; - return { - yAxis: [ - { - tickCount, - tickValues, - formatYLabel: formatLabel, - axisSide, - lineColor, - lineWidth, - labelColor, - labelOffset: resolvedLabelOffset, - font, - }, - ], - leftAxisLabelPadding: computeLeftAxisLabelPadding(axisSide, labelsForMeasurement, font, resolvedLabelOffset), + let axisSide: XAxisSide | YAxisSide | undefined; + let labelOffset: number | undefined; + let xAxis: CartesianChartProps['xAxis'] | undefined; + let yAxis: CartesianChartProps['yAxis'] | undefined; + + let leftAxisSize: number | undefined; + let rightAxisSize: number | undefined; + let bottomAxisSize: number | undefined; + let topAxisSize: number | undefined; + + if (isDependentAxis && isHorizontal) { + axisSide = orientation === 'right' ? 'top' : 'bottom'; + labelOffset = rawLabelOffset; + xAxis = { + tickCount, + tickValues, + formatXLabel: formatLabel, + axisSide, + lineColor, + lineWidth, + labelColor, + labelOffset, + font, }; - } - return { - xAxis: { + } else if (isDependentAxis && !isHorizontal) { + axisSide = orientation === 'right' ? 'right' : 'left'; + labelOffset = rawLabelOffset; + yAxis = [ + { + tickCount, + tickValues, + formatYLabel: formatLabel, + axisSide, + lineColor, + lineWidth, + labelColor, + labelOffset, + font, + }, + ]; + } else if (!isDependentAxis && isHorizontal) { + axisSide = orientation === 'top' ? 'right' : 'left'; + labelOffset = axisSide === 'left' && rawLabelOffset !== undefined ? Math.min(rawLabelOffset, LEFT_AXIS_LABEL_OFFSET_MAX) : rawLabelOffset; + yAxis = [ + { + tickCount, + tickValues, + formatYLabel: formatLabel, + axisSide, + lineColor, + lineWidth, + labelColor, + labelOffset, + font, + }, + ]; + } else if (!isDependentAxis && !isHorizontal) { + axisSide = orientation === 'top' ? 'top' : 'bottom'; + labelOffset = rawLabelOffset; + xAxis = { tickCount, tickValues, formatXLabel: formatLabel, - axisSide: orientation === 'top' ? 'top' : 'bottom', + axisSide, lineColor, lineWidth, labelColor, labelOffset, font, - }, + }; + } + + // The axis size is used to reduce the size of the padding since the axis labels consume part of the drawing window + // and we need to compensate for that otherwise the chart will look smaller + if (axisSide) { + const axisSize = computeAxisSize(axisSide, labelsForMeasurement, font, labelOffset); + switch (axisSide) { + case 'left': + leftAxisSize = axisSize; + break; + case 'right': + rightAxisSize = axisSize; + break; + case 'bottom': + bottomAxisSize = axisSize; + break; + case 'top': + topAxisSize = axisSize; + break; + default: + break; + } + } + + return { + xAxis, + yAxis, + leftAxisSize, + rightAxisSize, + bottomAxisSize, + topAxisSize, }; } diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/types.ts b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/types.ts index c7addc6a3472..7151312d53c6 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/types.ts +++ b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/types.ts @@ -169,9 +169,12 @@ type ProcessNodeResult = { yAxis: CartesianChartProps['yAxis']; domain: CartesianChartProps['domain']; domainPadding: CartesianChartProps['domainPadding']; + designPadding: CartesianChartProps['padding']; padding: CartesianChartProps['padding']; - // Pixel width the left y-axis actually needs for its widest label, used to shrink `padding.left` when it's larger than the content requires. - leftAxisLabelPadding: number | undefined; + leftAxisSize: number | undefined; + rightAxisSize: number | undefined; + bottomAxisSize: number | undefined; + topAxisSize: number | undefined; isHorizontal: boolean | undefined; categories: string[] | undefined; labelItems: LabelItem[]; diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/computeDynamicChartHeight.ts b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/computeDynamicChartHeight.ts index aa2f8852ed2a..82df00749e17 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/computeDynamicChartHeight.ts +++ b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/computeDynamicChartHeight.ts @@ -33,20 +33,20 @@ type ComputeDynamicChartHeightParams = { designHeight: number | undefined; isHorizontal: boolean | undefined; itemCount: number; - padding: Padding; + designPadding: Padding; }; /** * Derives a shorter canvas height for horizontal bar charts that have fewer rows than the * backend's fixed five-row reference height, keeping row spacing consistent. */ -function computeDynamicChartHeight({designHeight, isHorizontal, itemCount, padding}: ComputeDynamicChartHeightParams): number | undefined { +function computeDynamicChartHeight({designHeight, isHorizontal, itemCount, designPadding}: ComputeDynamicChartHeightParams): number | undefined { if (!isHorizontal || designHeight === undefined || itemCount <= 0 || itemCount >= HORIZONTAL_BAR_REFERENCE_ROW_COUNT) { return designHeight; } - const paddingTop = getPaddingValue(padding, 'top', DEFAULT_HORIZONTAL_BAR_PADDING.top); - const paddingBottom = getPaddingValue(padding, 'bottom', DEFAULT_HORIZONTAL_BAR_PADDING.bottom); + const paddingTop = getPaddingValue(designPadding, 'top', DEFAULT_HORIZONTAL_BAR_PADDING.top); + const paddingBottom = getPaddingValue(designPadding, 'bottom', DEFAULT_HORIZONTAL_BAR_PADDING.bottom); const referencePlotHeight = HORIZONTAL_BAR_REFERENCE_HEIGHT - paddingTop - paddingBottom; if (referencePlotHeight <= 0) { diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/resolvePadding.ts b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/resolvePadding.ts index d090f0b5c204..5d4504453272 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/resolvePadding.ts +++ b/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/resolvePadding.ts @@ -1,17 +1,61 @@ import {LEFT_AXIS_LABEL_PADDING} from '@components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/constants'; import type {ProcessNodeResult} from '@components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/types'; -import lodashIsObject from 'lodash/isObject'; - /** - * Shrinks `padding.left` down to the left axis's measured label width (plus a small edge buffer) - * whenever the configured padding is wider than the label content actually needs. + * Shrinks the padding to take into account the size consumed by the axis. */ -function resolvePadding(padding: ProcessNodeResult['padding'], leftAxisLabelPadding: ProcessNodeResult['leftAxisLabelPadding']): ProcessNodeResult['padding'] { - if (leftAxisLabelPadding === undefined || !lodashIsObject(padding) || typeof padding.left !== 'number') { - return padding; +function resolvePadding( + padding: ProcessNodeResult['padding'], + xAxis: ProcessNodeResult['xAxis'], + yAxis: ProcessNodeResult['yAxis'], + leftAxisSize: ProcessNodeResult['leftAxisSize'], + rightAxisSize: ProcessNodeResult['rightAxisSize'], + bottomAxisSize: ProcessNodeResult['bottomAxisSize'], + topAxisSize: ProcessNodeResult['topAxisSize'], + isHorizontal: ProcessNodeResult['isHorizontal'], +): ProcessNodeResult['padding'] { + if (!padding) { + return; + } + + let resolvedPadding: ProcessNodeResult['padding']; + if (typeof padding === 'number') { + resolvedPadding = { + left: padding, + right: padding, + top: padding, + bottom: padding, + }; + } else { + resolvedPadding = {...padding}; } - return {...padding, left: Math.min(padding.left, Math.ceil(leftAxisLabelPadding) + LEFT_AXIS_LABEL_PADDING)}; + + // Shrink `padding.left` down to the left axis's measured label width (plus a small edge buffer) + // whenever the configured padding is wider than the label content actually needs. + if (isHorizontal && leftAxisSize && resolvedPadding.left) { + resolvedPadding.left = Math.min(resolvedPadding.left, leftAxisSize + LEFT_AXIS_LABEL_PADDING); + } + + // Shrink the paddings further to take into account the axis labels size + // The shrink is only needed if we are actually going to draw the axis labels i.e. `tickCount` > 0 + const shouldShrinkLeftPadding = Object.values(yAxis ?? {}).some((y) => y.tickCount && y.axisSide === 'left'); + const shouldShrinkRightPadding = Object.values(yAxis ?? {}).some((y) => y.tickCount && y.axisSide === 'right'); + const shouldShrinkBottomPadding = xAxis?.tickCount && xAxis.axisSide === 'bottom'; + const shouldShrinkTopPadding = xAxis?.tickCount && xAxis.axisSide === 'top'; + if (shouldShrinkLeftPadding && leftAxisSize && resolvedPadding.left) { + resolvedPadding.left -= leftAxisSize; + } + if (shouldShrinkRightPadding && rightAxisSize && resolvedPadding.right) { + resolvedPadding.right -= rightAxisSize; + } + if (shouldShrinkBottomPadding && bottomAxisSize && resolvedPadding.bottom) { + resolvedPadding.bottom -= bottomAxisSize; + } + if (shouldShrinkTopPadding && topAxisSize && resolvedPadding.top) { + resolvedPadding.top -= topAxisSize; + } + + return resolvedPadding; } export default resolvePadding; diff --git a/tests/unit/components/HTMLEngineProvider/VictoryChartExpandModalTest.tsx b/tests/unit/components/HTMLEngineProvider/VictoryChartExpandModalTest.tsx index 8e29574e1057..821ba2caa96c 100644 --- a/tests/unit/components/HTMLEngineProvider/VictoryChartExpandModalTest.tsx +++ b/tests/unit/components/HTMLEngineProvider/VictoryChartExpandModalTest.tsx @@ -35,7 +35,10 @@ const processedResult = { domain: undefined, domainPadding: 20, padding: 16, - leftAxisLabelPadding: undefined, + leftAxisSize: undefined, + rightAxisSize: undefined, + bottomAxisSize: undefined, + topAxisSize: undefined, isHorizontal: false, categories: undefined, labelItems: [], diff --git a/tests/unit/components/HTMLEngineProvider/VictoryChartScaledProviderTest.tsx b/tests/unit/components/HTMLEngineProvider/VictoryChartScaledProviderTest.tsx index 65bfcba3d9d0..73516b8001e1 100644 --- a/tests/unit/components/HTMLEngineProvider/VictoryChartScaledProviderTest.tsx +++ b/tests/unit/components/HTMLEngineProvider/VictoryChartScaledProviderTest.tsx @@ -23,7 +23,10 @@ const processedResult = { domain: undefined, domainPadding: 20, padding: 16, - leftAxisLabelPadding: undefined, + leftAxisSize: undefined, + rightAxisSize: undefined, + bottomAxisSize: undefined, + topAxisSize: undefined, isHorizontal: false, categories: undefined, labelItems: [{x: 340, y: 24, text: 'Title', fontSize: {0: 14}}], diff --git a/tests/unit/computeDynamicChartHeightTest.ts b/tests/unit/computeDynamicChartHeightTest.ts index 6ff4f39a4aad..33aee49c20c3 100644 --- a/tests/unit/computeDynamicChartHeightTest.ts +++ b/tests/unit/computeDynamicChartHeightTest.ts @@ -10,7 +10,7 @@ describe('computeDynamicChartHeight', () => { designHeight, isHorizontal: false, itemCount: 2, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBe(designHeight); }); @@ -21,7 +21,7 @@ describe('computeDynamicChartHeight', () => { designHeight, isHorizontal: true, itemCount: 5, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBe(designHeight); }); @@ -32,7 +32,7 @@ describe('computeDynamicChartHeight', () => { designHeight, isHorizontal: true, itemCount: 6, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBe(designHeight); }); @@ -43,7 +43,7 @@ describe('computeDynamicChartHeight', () => { designHeight, isHorizontal: true, itemCount: 0, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBe(designHeight); }); @@ -54,7 +54,7 @@ describe('computeDynamicChartHeight', () => { designHeight: undefined, isHorizontal: true, itemCount: 2, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBeUndefined(); }); @@ -65,7 +65,7 @@ describe('computeDynamicChartHeight', () => { designHeight, isHorizontal: true, itemCount: 2, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBe(291); }); @@ -76,7 +76,7 @@ describe('computeDynamicChartHeight', () => { designHeight, isHorizontal: true, itemCount: 2, - padding: undefined, + designPadding: undefined, }), ).toBe(291); }); @@ -87,7 +87,7 @@ describe('computeDynamicChartHeight', () => { designHeight: 300, isHorizontal: true, itemCount: 2, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBe(291); }); @@ -98,7 +98,7 @@ describe('computeDynamicChartHeight', () => { designHeight: 250, isHorizontal: true, itemCount: 2, - padding: horizontalChartPadding, + designPadding: horizontalChartPadding, }), ).toBe(250); });