Skip to content

Commit b606028

Browse files
Update packages/x-charts/src/context/CartesianProvider/computeValue.ts
Co-authored-by: Alexandre Fauquette <[email protected]> Signed-off-by: Jose C Quintas Jr <[email protected]>
1 parent 5062469 commit b606028

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/x-charts/src/context/CartesianProvider/computeValue.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ export function computeValue(
8282

8383
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
8484
const barGapRatio = axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
85-
const scaleRange = axisName === 'x' ? range : [...range].reverse();
85+
// Reverse range because ordinal scales are presented from top to bottom on y-axis
86+
const scaleRange = axisName === 'x' ? range : [range[1], range[0]];
8687

8788
completeAxis[axis.id] = {
8889
categoryGapRatio,

0 commit comments

Comments
 (0)