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

[pie-chart] Restricting query to single metric #5203

Merged

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Jun 14, 2018

The pie chart should only allow specifying one metric in the UI. It always uses the first metric if multiple are specified, though this PR simply enforces the single metric UI component.

to: @williaster @GabeLoins @mistercrunch

@codecov-io
Copy link

codecov-io commented Jun 14, 2018

Codecov Report

Merging #5203 into master will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5203      +/-   ##
==========================================
+ Coverage   63.39%   63.45%   +0.06%     
==========================================
  Files         261      261              
  Lines       19838    19838              
  Branches     1995     1995              
==========================================
+ Hits        12577    12589      +12     
+ Misses       7252     7240      -12     
  Partials        9        9
Impacted Files Coverage Δ
superset/assets/src/explore/visTypes.js 62.5% <ø> (ø) ⬆️
superset/models/core.py 86.54% <0%> (+0.18%) ⬆️
superset/views/core.py 74.66% <0%> (+0.22%) ⬆️
superset/db_engine_specs.py 53.71% <0%> (+1.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b7a14d...11bfdbc. Read the comment docs.

@williaster
Copy link
Contributor

LGTM 🚢

@mistercrunch
Copy link
Member

I think it used to allow multiple metrics or one metric along with a groupby.

People may have metrics like boys and girls as different columns in their table.

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

Also I'm pretty sure this will break existing charts. I think this would require a db migration moving the form_data from metrics to metric and selecting the first position of the array

@john-bodley
Copy link
Member Author

john-bodley commented Jun 14, 2018

@mistercrunch the pie-chart simply uses the first metric (so it works for metrics) which is the same behavior as the country-map (as well as others) and this is also configured using the metric (singular) field.

It seems there are multiple metric-keys supported, including metric and metrics. I've added a migration to ensure consistency, i.e., metric in the form-data translates to metric in the viz-type.

Note @mistercrunch I'm not sure what the policy is around form-data attributes but for the migration I simply remove the attribute (to prevent bloat) rather than storing None or [].

@john-bodley john-bodley force-pushed the john-bodley-pie-chart-single-metric branch from eba98f5 to 1751fa5 Compare June 14, 2018 21:47
@john-bodley john-bodley force-pushed the john-bodley-pie-chart-single-metric branch from 1751fa5 to 11bfdbc Compare June 14, 2018 21:56
@john-bodley john-bodley merged commit 8cdc9ca into apache:master Jun 15, 2018
@mistercrunch
Copy link
Member

LGTM, sorry about the confusion.

About how to deal with empty form_data or form_data key that match their default value is we should save all of the keys defined for that chart type at that point in time. That way if the default value changes the chart would still look the same. In some cases, null or [] may actually be different from the default, so we should save whatever the value is.

In this case here there should always be one metric so the db migration is fine.

john-bodley added a commit to john-bodley/superset that referenced this pull request Jun 19, 2018
timifasubaa pushed a commit to airbnb/superset-fork that referenced this pull request Jul 25, 2018
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.26.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.26.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants