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

log axes in Chart #1052

Open
sarah-ek opened this issue Apr 19, 2024 · 3 comments
Open

log axes in Chart #1052

sarah-ek opened this issue Apr 19, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@sarah-ek
Copy link

Problem

chart only allows a linear scale for the x and y axes

Solution

make chart a stateful widget so the x and y axes can be changed at runtime from linear to logarithmic

Alternatives

make separate widgets for log scaled charts, but that would lead to having 4 widgets that do very similar things

@sarah-ek sarah-ek added the enhancement New feature or request label Apr 19, 2024
@joshka
Copy link
Member

joshka commented Apr 19, 2024

This is a good idea, but it shouldn't require the widget to be made stateful as that is usually only necessary when there's state that has to be modified during rendering. I think this can probably be a normal property on the Axis type.

Would you consider raising a PR for this?

I think maybe this would look like:

  • add a Scale enum with two values: Log, Linear (default value)
  • add a scale field to the Axis struct and setter methods
  • adjust the rendering of values and axis
  • add docs for the new types / functions / values
  • add unit tests
  • add log axes to the chart example and reformat the size if needed to make the gif look good

@sarah-ek
Copy link
Author

I'm not very familiar with the internals of the library but i can try

@joshka
Copy link
Member

joshka commented Apr 19, 2024

I'm not very familiar with the internals of the library but i can try

No problem - we try to write code in a style that makes it easy for anyone to add features by following the same ideas as what is already there. Keep things consistent with what you see and you'll be mostly ok, and for the rest we can provide feedback that helps guide things in the right direction. Don't hesitate to reach out here or in the feature discussion channel on discord / matrix if needed.

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

No branches or pull requests

2 participants