[xychart] How to ensure extra height for rotated ticks when using parentSize #1494
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @chrisbenincasa 👋 thanks for checking out visx, I'm going to convert this to a discussion since it's more about usage than an issue. This is a tricky thing to do dynamically, to do it properly you basically have to render your tick text with font/letter-spacing/font-size/etc. applied and measure its width. then you can ensure the proper width (and in your case take rotation into account which wouldn't be that hard). I have a couple thoughts:
Hope that helps! good looking chart :) |
Beta Was this translation helpful? Give feedback.
Hey @chrisbenincasa 👋 thanks for checking out visx, I'm going to convert this to a discussion since it's more about usage than an issue.
This is a tricky thing to do dynamically, to do it properly you basically have to render your tick text with font/letter-spacing/font-size/etc. applied and measure its width. then you can ensure the proper width (and in your case take rotation into account which wouldn't be that hard). I have a couple thoughts:
manually you can very easily just increase the chart bottom margin
<XYChart margin={{ ...top/right/left, bottom: 100 }} {...} />
. In the docs this is just described asMargin
but if you have TS you'll see{ top: number; right: number; bottom: nu…