-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use SVG/images as axis ticks? #513
Comments
Thanks @fromaline Axis tick labels don't support custom content. This would be a great addition to the library. Let me know if you want to try adding this feature yourself, I'll be happy to point you to the right place in the code. |
@rokotyan, thanks for your response! I really need this functionality for my project, so I’ll give it a shot. Could you please point me in the right direction? |
@fromaline Once you've cloned the repo, do Search for an Axis example there. Ideally copy an example to have a dedicated one for the feature you'll be working on (maybe copy this one Then explore this section of the Area component's code: unovis/packages/ts/src/components/axis/index.ts Lines 222 to 245 in 75c6dfe
Most likely your changes will go somewhere there. |
@rokotyan, thanks for the info! I went through the code, and it seems highly tailored toward text-based ticks. Do you have any suggestions for implementing images as ticks? I’d like to keep it as simple as possible, but it feels like it might require quite a bit of coding and testing — I’m not sure it’s worth the effort. |
@fromaline Yes, you'll need to completely replace the If I were to implement this, I would allow The Graph component has something similar: unovis/packages/ts/src/components/graph/modules/shape.ts Lines 27 to 39 in 75c6dfe
|
@rokotyan, got it! Thanks for the hint! |
Hey, thanks for this fantastic library!
I’m using it in a Svelte/SvelteKit project and’d like to use SVG as an axis tick label. I tried using
tickFormat
to return an<img>
tag or an SVG directly, but it doesn't work. Is there a way to do it?The text was updated successfully, but these errors were encountered: