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

Labels truncated when flipped with Y axis set on the right #40

Closed
tlvenn opened this issue Jan 4, 2022 · 2 comments
Closed

Labels truncated when flipped with Y axis set on the right #40

tlvenn opened this issue Jan 4, 2022 · 2 comments

Comments

@tlvenn
Copy link

tlvenn commented Jan 4, 2022

I am experimenting with placing the Y axis on the right and flipping the labels as mentioned in #38

AxisGuide(
    position: 1,
    flip: true,
    label: LabelStyle(
      Defaults.textStyle,
      offset: Offset(0, 0),
    ),
    grid: Defaults.strokeStyle,
  )

image

It seems the graph boundaries are not computed properly to allow room for the labels in that scenario.

@entronad
Copy link
Owner

entronad commented Jan 4, 2022

The space between the coordinate region and the chart boundary is called padding, just like in the CSS box model.

There is no intellectual magic in the padding calculation. They are just set by Chart.padding, with a default EdgeInsets.fromLTRB(40, 5, 10, 20). So if the labels are cut, just set another value to adjust.

Yet there is still a good news, padding property is a function of chart size, so you can do some responsive design in the setting.

@tlvenn
Copy link
Author

tlvenn commented Jan 4, 2022

Ha great, I was not sure this was 100% handled with the padding, makes total sense.

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