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

Allow Title and Legend bottom positioning and improve chart spacing #25

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

jentfoo
Copy link
Member

@jentfoo jentfoo commented Dec 31, 2024

This change was initially motivated to add bottom as a value that can be specified for the legend or title when rendering on the bottom is desired.

When adding that feature it was discovered that the title and legend spacing was inconsistent. For example if no title was specified the chart would extend into the legend. This change attempts to make that spacing more predictable and controllable:

  • If a title and legend exist on the top, they will attempt to share the space as done previously
  • If only a title exists on the top they will be given the space needed
  • If only a horizontal legend exists on the top, by default it is given space, but the prior behavior can be achieved by setting OverlayChart to *true in the LegendOptions
  • If a title or legend is set at the bottom, the chart space at the bottom will be given in a similar way as done on the top

In general the change here is pretty minor, but I believe this will be more predictable for the user, and given our tests overall this produced better spaced charts.

In the future we may enable OverlayChart to accept a *false to provide different behavior for vertical legends. This is why I felt a pointer may be better than a simple bool field.

This change was initially motivated to add `bottom` as a value that can be specified for the legend or title when rendering on the bottom is desired.

When adding that feature it was discovered that the title and legend spacing was inconsistent.  For example if no title was specified the chart would extend into the legend.  This change attempts to make that spacing more predictable and controllable:
  * If a title and legend exist on the top, they will attempt to share the space as done previously
  * If only a title exists on the top they will be given the space needed
  * If only a horizontal legend exists on the top, by default it is given space, but the prior behavior can be achieved by setting `OverlayChart` to `*true` in the `LegendOptions`
  * If a title or legend is set at the bottom, the chart space at the bottom will be given in a similar way as done on the top

In general the change here is pretty minor, but I believe this will be more predictable for the user, and given our tests overall this produced better spaced charts.

In the future we may enable `OverlayChart` to accept a `*false` to provide different behavior for vertical legends.  This is why I felt a pointer may be better than a simple bool field.
@jentfoo jentfoo added bug Something isn't working enhancement New feature or request labels Dec 31, 2024
@jentfoo jentfoo self-assigned this Dec 31, 2024
@jentfoo jentfoo changed the title Improve Title and Legend positioning and chart spacing Allow Title and Legend bottom positioning and improve chart spacing Dec 31, 2024
@jentfoo jentfoo merged commit 86a6839 into main Dec 31, 2024
8 checks passed
@jentfoo jentfoo deleted the jent/legend_title_spacing_improvements branch December 31, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant