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

Change Series Styling and Themes #15

Merged
merged 3 commits into from
Nov 5, 2024
Merged

Change Series Styling and Themes #15

merged 3 commits into from
Nov 5, 2024

Conversation

jentfoo
Copy link
Member

@jentfoo jentfoo commented Oct 31, 2024

This change removes the ability to configure the styling at the series level.

As seen in this change and discussed in issue #14, these style options were not very broadly recognized.

Instead the goal is to make theme customization easier. As a potential replacement to this configuration the Themes can now accept series and background color changes.

If we do decide that we want to bring back per-series styling, I think we should make those top level fields so that we only introduce fields which are broadly recognized.

As part of evaluating how the Style struct was used, it was decided to break out the Font portions (which are used more broadly) into their own FontStyle struct. This is a significant API change, both for users of the top level configuration, or users from wcharczuk/go-chart. But one which should be easy to transition to, and will be better for the long term.

In order to accommodate this change, at any point that FontSize, FontColor, or Font was being configured, this now must be encapsulated into a FontStyle struct. By having these values in a single struct you can now use several font configurations for different parts of the chart more easily.

In the end this PR fixes #14 by ensuring that configuration fields in charts are always interpreted when rendered, allowing the user to be confident that if it's available to be set, it should have a visual impact.

This change removes the ability to configure the styling at the series level.

As seen in this change and discussed in issue #14, these style options were not very broadly recognized.

Instead the goal is to make theme customization easier. As a potential replacement to this configuration the Themes can now accept series and background color changes.

If we do decide that we want to bring back per-series styling, I think we should make those top level fields so that we only introduce fiels which are broadly recognized.
@jentfoo jentfoo self-assigned this Oct 31, 2024
@jentfoo jentfoo mentioned this pull request Oct 31, 2024
This change removes the `FontSze`, `FontColor`, and `Font` from the `chartdraw.Style` struct and instead moves them to a `chartdraw.FontStyle`.

This is the first change since forking `wcharczuk/go-chart` that will make a transition require additional changes.  However I believe this is an important change.

Using the broad `Style` struct makes it non-obvious what values are actually being used.  In addition these font configurations are a common need, making an obvious choice for needing to bundle together.

By removing the `Style` from `charts`, we instead are elevating these fields to be part of the public configuration.  `Style` is now only used for rendering, and not part of the public API (unless using the `wcharczuk/go-chart` fork directly).
This change brings the `FontStyle` introduced in the prior commits into top level configuration.

Although this change introduces significant changes into how charts are configured, being able to reuse font references will make unique font configurations easier.
@jentfoo jentfoo force-pushed the jent/series_styling branch from 407fe74 to 0e421a2 Compare November 1, 2024 03:25
@jentfoo jentfoo merged commit 0e421a2 into main Nov 5, 2024
6 checks passed
@jentfoo jentfoo deleted the jent/series_styling branch November 6, 2024 15:55
@jentfoo jentfoo added the enhancement New feature or request label Dec 29, 2024
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

Successfully merging this pull request may close these issues.

Change pie chart color
1 participant