Skip to content

Commit b4e900e

Browse files
committed
fix: Bounding box issues.
1 parent 91c1c0f commit b4e900e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/parsers/helpers/axis-parser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function computeScale(state, axis, isX) {
9393
: axis.ordinal.length
9494
? scaleBand()
9595
: scaleLinear())
96-
.domain(axis.ordinal.length ? axis.ordinal : axis.domain)
96+
.domain(axis.ordinal.length ? axis.ordinal.reverse() : axis.domain)
9797
.range(axis.range);
9898

9999
const axisFn = isX ? axisBottom : axisLeft;
@@ -109,7 +109,7 @@ function computeScale(state, axis, isX) {
109109
axis.ticks.filter(d => d.value === axis.domain[1])[0].marks[0], 'left'
110110
);
111111

112-
const ticks = [tickLeft, tickRight].map(d => d - state.svg.getBBoxCustom().left);
112+
const ticks = [tickLeft, tickRight].map(d => d);
113113
const newDomainX = axis.range.map(
114114
axis.scale.copy().range(ticks).invert, axis.scale
115115
);
@@ -123,7 +123,7 @@ function computeScale(state, axis, isX) {
123123
axis.ticks.filter(d => d.value === axis.domain[1])[0].marks[0], 'top'
124124
);
125125

126-
const ticks = [tickTop, tickBottom].map(d => d - state.svg.getBBoxCustom().top);
126+
const ticks = [tickTop, tickBottom].map(d => d);
127127
const newDomainY = axis.range.map(
128128
axis.scale.copy().range(ticks).invert, axis.scale
129129
);

src/parsers/helpers/data-parser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ export function inferMarkAttributes(state) {
9393
const markX = state.xAxis.ordinal.length
9494
? i
9595
: state.yAxis.ordinal.length || mark.type === 'rect'
96-
? markRect.right - svgRect.left
97-
: markRect.centerX - svgRect.left;
96+
? markRect.right
97+
: markRect.centerX;
9898
const markY = state.yAxis.ordinal.length
9999
? i
100100
: state.xAxis.ordinal.length
101-
? markRect.top - svgRect.top
102-
: markRect.centerY - svgRect.top;
101+
? markRect.top
102+
: markRect.centerY;
103103

104104
// console.log(state.xAxis.scale.domain()[markX])
105105
const iterable = { };

0 commit comments

Comments
 (0)