accept axis: "both" for x and y axes#631
Closed
Fil wants to merge 1 commit into
Closed
Conversation
note that we avoid showing the label and the grid twice closes #148
Member
|
Very cool! Will review soon. |
mbostock
requested changes
Jan 19, 2022
Member
mbostock
left a comment
There was a problem hiding this comment.
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; |
Member
There was a problem hiding this comment.
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() |
Member
There was a problem hiding this comment.
Using D3 here feels like overkill.
| } = {}) { | ||
| this.name = name; | ||
| this.axis = keyword(axis, "axis", ["left", "right"]); | ||
| this.axis = keyword(axis, "axis", name === "y" ? ["left", "right", "both"] : ["left", "right"]); |
Member
There was a problem hiding this comment.
What about both for facet axes?
| grid: true, | ||
| zero: true | ||
| zero: true, | ||
| axis: "both" |
Member
There was a problem hiding this comment.
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.
Contributor
Author
|
I want to revisit this as part of "axes as marks" (#1000). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
note that we avoid showing the label and the grid twice
closes #148