-
Notifications
You must be signed in to change notification settings - Fork 178
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
Conversation
note that we avoid showing the label and the grid twice closes #148
Very cool! Will review soon. |
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
? create("svg:g") | ||
.call(g => g.append(() => axes[0])) | ||
.call(g => g.append(() => axes[1])) | ||
.node() |
There was a problem hiding this comment.
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"]); |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
I want to revisit this as part of "axes as marks" (#1000). |
note that we avoid showing the label and the grid twice
closes #148