Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make right axis rotate the same way as left #3759

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/vega-parser/src/parsers/guides/axis-title.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getSign, ifTop, ifX, ifY, mult, patch} from './axis-util';
import {ifTop, ifX, ifY, ifRight, patch} from './axis-util';

Check failure on line 1 in packages/vega-parser/src/parsers/guides/axis-title.js

View workflow job for this annotation

GitHub Actions / Node 18

Member 'ifRight' of the import declaration should be sorted alphabetically

Check failure on line 1 in packages/vega-parser/src/parsers/guides/axis-title.js

View workflow job for this annotation

GitHub Actions / Node 20

Member 'ifRight' of the import declaration should be sorted alphabetically
import {Bottom, GuideTitleStyle, Top, one, zero} from './constants';
import guideMark from './guide-mark';
import {alignExpr, anchorExpr, lookup} from './guide-util';
Expand All @@ -9,8 +9,7 @@

export default function(spec, config, userEncode, dataRef) {
const _ = lookup(spec, config),
orient = spec.orient,
sign = getSign(orient, -1, 1);
orient = spec.orient;

let enter, update;
const encode = {
Expand All @@ -34,8 +33,8 @@

update.x = ifX(orient, titlePos);
update.y = ifY(orient, titlePos);
enter.angle = ifX(orient, zero, mult(sign, 90));
enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), {value: Bottom});
enter.angle = ifX(orient, zero, {value: -90});
enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), ifRight(orient, Top, Bottom));
update.angle = enter.angle;
update.baseline = enter.baseline;

Expand Down
4 changes: 2 additions & 2 deletions packages/vega/test/scenegraphs/chart-rangestep.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,11 @@
"x": 35,
"y": 100,
"align": "center",
"baseline": "bottom",
"baseline": "top",
"fill": "#000",
"opacity": 1,
"text": "Right Title",
"angle": 90,
"angle": -90,
"font": "sans-serif",
"fontSize": 11,
"fontWeight": "bold"
Expand Down
4 changes: 2 additions & 2 deletions packages/vega/test/scenegraphs/chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,11 @@
"x": 35,
"y": 111,
"align": "center",
"baseline": "bottom",
"baseline": "top",
"fill": "#000",
"opacity": 1,
"text": "Right Title",
"angle": 90,
"angle": -90,
"font": "sans-serif",
"fontSize": 11,
"fontWeight": "bold"
Expand Down
4 changes: 2 additions & 2 deletions packages/vega/test/scenegraphs/font-size-steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,14 @@
"x": 44,
"y": 100,
"align": "center",
"baseline": "bottom",
"baseline": "top",
"fill": "#000",
"opacity": 1,
"text": [
"Font Size",
"(Log-Transformed)"
],
"angle": 90,
"angle": -90,
"font": "sans-serif",
"fontSize": 11,
"fontWeight": "bold"
Expand Down
16 changes: 8 additions & 8 deletions packages/vega/test/scenegraphs/layout-splom.json
Original file line number Diff line number Diff line change
Expand Up @@ -39630,11 +39630,11 @@
"x": 27,
"y": 60,
"align": "center",
"baseline": "bottom",
"baseline": "top",
"fill": "#000",
"opacity": 1,
"text": "Beak Length (mm)",
"angle": 90,
"angle": -90,
"font": "sans-serif",
"fontSize": 11,
"fontWeight": "bold"
Expand Down Expand Up @@ -39817,11 +39817,11 @@
"x": 27,
"y": 60,
"align": "center",
"baseline": "bottom",
"baseline": "top",
"fill": "#000",
"opacity": 1,
"text": "Beak Depth (mm)",
"angle": 90,
"angle": -90,
"font": "sans-serif",
"fontSize": 11,
"fontWeight": "bold"
Expand Down Expand Up @@ -40046,11 +40046,11 @@
"x": 35,
"y": 60,
"align": "center",
"baseline": "bottom",
"baseline": "top",
"fill": "#000",
"opacity": 1,
"text": "Flipper Length (mm)",
"angle": 90,
"angle": -90,
"font": "sans-serif",
"fontSize": 11,
"fontWeight": "bold"
Expand Down Expand Up @@ -40212,11 +40212,11 @@
"x": 51,
"y": 60,
"align": "center",
"baseline": "bottom",
"baseline": "top",
"fill": "#000",
"opacity": 1,
"text": "Body Mass (g)",
"angle": 90,
"angle": -90,
"font": "sans-serif",
"fontSize": 11,
"fontWeight": "bold"
Expand Down