Skip to content
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

xAxis/yAxis need an option to not render the label section #480

Open
prashanFOMO opened this issue Jan 19, 2025 · 2 comments
Open

xAxis/yAxis need an option to not render the label section #480

prashanFOMO opened this issue Jan 19, 2025 · 2 comments

Comments

@prashanFOMO
Copy link

While it is possible to leave xAxis/yAxis unset to not render the label section, this has a fatal flaw: this means that the default configuration for rendering lines will be used.

For my use-case, I'd like to be able to not render the yAxis labels NOR the lines. But currently my options are:

  1. ) Set yAxis to something like:
yAxis={[{
  font,
  labelColor: 'transparent',
  lineColor: 'transparent',
}]}

or 2.) omit yAxis entirely

But each has their own problem:
1.) Lines do not render (nor labels), but the area that the labels would take up is still there.
2.) Label area is not rendered at all (correct), but default line configuration means that the lines are still rendered (wrong).

@prashanFOMO
Copy link
Author

By digging through the source, I was able to find a workaround:
https://github.com/FormidableLabs/victory-native-xl/blob/main/lib/src/cartesian/hooks/useBuildChartAxis.ts#L178

If I set axisOptions={{ lineWidth: 0 }}, this achieves an effect satisfactory for my use-case.

But, it seems weird that I need to set a deprecated prop to achieve this.

@zibs
Copy link
Contributor

zibs commented Jan 20, 2025

Can you do something like:

yAxis={{
....
lineWidth: 0
}},
xAxis={{ ...., lineWidth: 0 }}

I agree that you shouldn't have to use the deprecated prop to accomplish what you're trying to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants