Skip to content

Commit

Permalink
fix: Bounding box issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-s-snyder committed Nov 1, 2024
1 parent 91c1c0f commit b4e900e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/parsers/helpers/axis-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function computeScale(state, axis, isX) {
: axis.ordinal.length
? scaleBand()
: scaleLinear())
.domain(axis.ordinal.length ? axis.ordinal : axis.domain)
.domain(axis.ordinal.length ? axis.ordinal.reverse() : axis.domain)
.range(axis.range);

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

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

const ticks = [tickTop, tickBottom].map(d => d - state.svg.getBBoxCustom().top);
const ticks = [tickTop, tickBottom].map(d => d);
const newDomainY = axis.range.map(
axis.scale.copy().range(ticks).invert, axis.scale
);
Expand Down
8 changes: 4 additions & 4 deletions src/parsers/helpers/data-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ export function inferMarkAttributes(state) {
const markX = state.xAxis.ordinal.length
? i
: state.yAxis.ordinal.length || mark.type === 'rect'
? markRect.right - svgRect.left
: markRect.centerX - svgRect.left;
? markRect.right
: markRect.centerX;
const markY = state.yAxis.ordinal.length
? i
: state.xAxis.ordinal.length
? markRect.top - svgRect.top
: markRect.centerY - svgRect.top;
? markRect.top
: markRect.centerY;

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

0 comments on commit b4e900e

Please sign in to comment.