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

accept axis: "both" for x and y axes #631

Closed
wants to merge 1 commit into from
Closed

accept axis: "both" for x and y axes #631

wants to merge 1 commit into from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Dec 22, 2021

note that we avoid showing the label and the grid twice

closes #148

note that we avoid showing the label and the grid twice

closes #148
@mbostock
Copy link
Member

Very cool! Will review soon.

Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a nice feature! A few things to figure out…

autoAxisLabelsX(x, scales.x, channels.get("x"));
if (x.labelOffset === undefined) {
const {marginTop, marginBottom, facetMarginTop, facetMarginBottom} = dimensions;
x.labelOffset = x.axis === "top" ? marginTop - facetMarginTop : marginBottom - facetMarginBottom;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By moving this to src/axis.js, we effectively lose control over this option for the both axis.

Comment on lines +98 to +101
? create("svg:g")
.call(g => g.append(() => axes[0]))
.call(g => g.append(() => axes[1]))
.node()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using D3 here feels like overkill.

@@ -107,7 +120,7 @@ export class AxisY {
tickRotate
} = {}) {
this.name = name;
this.axis = keyword(axis, "axis", ["left", "right"]);
this.axis = keyword(axis, "axis", name === "y" ? ["left", "right", "both"] : ["left", "right"]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about both for facet axes?

@@ -9,7 +9,8 @@ export default async function() {
},
y: {
grid: true,
zero: true
zero: true,
axis: "both"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’d be better to have a new test that demonstrates a more appropriate use of both axis rather than tacking it on to some of the existing tests.

@Fil Fil marked this pull request as draft July 18, 2022 14:05
@Fil
Copy link
Contributor Author

Fil commented Jul 18, 2022

I want to revisit this as part of "axes as marks" (#1000).

@mbostock mbostock mentioned this pull request Dec 30, 2022
36 tasks
@Fil Fil deleted the fil/axis-both branch June 7, 2023 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repeating axes on both sides (axis: "both")?
2 participants