Skip to content

[xychart] How to ensure extra height for rotated ticks when using parentSize #1494

Answered by williaster
chrisbenincasa asked this question in Q&A
Discussion options

You must be logged in to vote

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:

  1. 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 as Margin but if you have TS you'll see { top: number; right: number; bottom: nu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chrisbenincasa
Comment options

Answer selected by chrisbenincasa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1493 on May 06, 2022 17:55.