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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

BarChart: Fix value mappings #60066

Merged
merged 2 commits into from Dec 9, 2022
Merged

Conversation

leeoniya
Copy link
Contributor

@leeoniya leeoniya commented Dec 9, 2022

Fixes #59776
Fixes #60002

i broke this over a month ago in #58285

you can test this by adding any Value type mapping in any BarChart panel.

apparently my mental model of value mappings having the same structure was incorrect. they're all the same except the most common ValueToText one 馃う

image

f.config.mappings?.some((m) => {
// ValueToText mappings have a different format, where all of them are grouped into an object keyed by value
if (m.type === 'value') {
// === MappingType.ValueToText
Copy link
Contributor Author

@leeoniya leeoniya Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was on the previous line, until Prettier "fixed" it 馃檮

this is here because we currently have an issue with schema gen which exports enums only as types, so the values cannot be used as RHS. @sdboyer is on it, but we can probably just land it like this, since that can take more time and we'll want this fix to land in the next patch release.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃槵 that sucks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, this is already fixed in #55769 - i'm just loathe to pull it out and inevitably create a merge conflict there when it's already so close

i'll do it if that PR doesn't land by next week though

@leeoniya leeoniya enabled auto-merge (squash) December 9, 2022 17:36
@leeoniya leeoniya merged commit 8317bf5 into main Dec 9, 2022
@leeoniya leeoniya deleted the leeoniya/barchart-value-mappings-fix branch December 9, 2022 17:52
grafanabot pushed a commit that referenced this pull request Dec 9, 2022
leeoniya added a commit that referenced this pull request Dec 9, 2022
BarChart: Fix value mappings (#60066)

(cherry picked from commit 8317bf5)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
GuYounes pushed a commit to paul-wurth/BIXpert that referenced this pull request Feb 8, 2023
BarChart: Fix value mappings (grafana#60066)

(cherry picked from commit 8317bf5)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bar Chart error with MySQL queries Cannot read properties of undefined (reading 'color') on Bar Chart
4 participants