How to have custom text for labels #1044
Answered
by
mbostock
rpivovar-godaddy
asked this question in
Q&A
-
I have charts which can have only two values along the y-axis: 0 or 1. Currently the y-axis labels are these two numbers, but I'd like to instead change the labels to say "Up" and "Down". Is there a way to do this? |
Beta Was this translation helpful? Give feedback.
Answered by
mbostock
Sep 9, 2022
Replies: 1 comment 1 reply
-
One way to do this is to use the y-scale tickFormat option: Plot.plot({
y: {
tickFormat: d => d ? "Up" : "Down"
},
marks: …
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Fil
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One way to do this is to use the y-scale tickFormat option: