setting yScale min value for XYchart #1242
-
I'm in the middle of converting a nivo line chart to use the visx xychart and I'm getting stuck on this one part. Nivo allows you to pass this to the yScale prop
Setting min to "auto" will automatically find your minimum y value and set it to that instead of 0. This will work even though there are multiple lines in the line chart and it will find the minimum y value for all the lines. Is there a way to do the same thing using XYchart when there are multiple lines for a line chart? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @davidhan527 👋 thanks for checking out Overall the x/y-scale config for Again, there's more info in the other discussion about controlling the range, but hopefully this helps with your immediate problem! |
Beta Was this translation helpful? Give feedback.
Hey @davidhan527 👋 thanks for checking out
visx
. This question is pretty similar to the discussion in #1147, so maybe check that out.Overall the x/y-scale config for
@visx/xychart
mirrors what's available in the@visx/scale
package so the scale docs might be useful. By defaultlinear
type scales inXYChart
will automatically set the min/max based on the data from all series but they will also include zero (mostly since this is often data vis best practice, so we default to that). You can turn this off simply by settingyScale={{ type: 'linear', zero: false }}
.Again, there's more info in the other discussion about controlling the range, but hopefully this helps with your immediate problem!