-
Notifications
You must be signed in to change notification settings - Fork 14k
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
feat: add ECharts Pie chart #10966
feat: add ECharts Pie chart #10966
Conversation
they look awesome!!thank you Ville! |
f2a4b9b
to
f245670
Compare
class TestDistributionPieViz(SupersetTestCase): | ||
base_df = pd.DataFrame( | ||
data={ | ||
"intcol": [1, 2, 3, 4, None], | ||
"floatcol": [1.0, 0.2, 0.3, 0.4, None], | ||
"strcol_a": ["a", "a", "a", "a", None], | ||
"strcol": ["a", "b", "c", None, "d"], | ||
} | ||
) | ||
|
||
@staticmethod | ||
def get_cols(data: List[Dict[str, Any]]) -> Set[str]: | ||
return set([row["x"] for row in data]) | ||
|
||
def test_bool_groupby(self): | ||
datasource = self.get_datasource_mock() | ||
df = pd.DataFrame(data={"intcol": [1, 2, None], "boolcol": [True, None, False]}) | ||
|
||
pie_viz = viz.DistributionPieViz( | ||
datasource, {"metrics": ["intcol"], "groupby": ["boolcol"]}, | ||
) | ||
data = pie_viz.get_data(df) | ||
assert self.get_cols(data) == {"True", "False", "<NULL>"} | ||
|
||
def test_string_groupby(self): | ||
datasource = self.get_datasource_mock() | ||
pie_viz = viz.DistributionPieViz( | ||
datasource, {"metrics": ["floatcol"], "groupby": ["strcol"]}, | ||
) | ||
data = pie_viz.get_data(self.base_df) | ||
assert self.get_cols(data) == {"<NULL>", "a", "b", "c", "d"} | ||
|
||
def test_int_groupby(self): | ||
datasource = self.get_datasource_mock() | ||
pie_viz = viz.DistributionPieViz( | ||
datasource, {"metrics": ["floatcol"], "groupby": ["intcol"]}, | ||
) | ||
data = pie_viz.get_data(self.base_df) | ||
assert self.get_cols(data) == {"<NULL>", "1", "2", "3", "4"} | ||
|
||
def test_float_groupby(self): | ||
datasource = self.get_datasource_mock() | ||
pie_viz = viz.DistributionPieViz( | ||
datasource, {"metrics": ["intcol"], "groupby": ["floatcol"]}, | ||
) | ||
data = pie_viz.get_data(self.base_df) | ||
assert self.get_cols(data) == {"<NULL>", "1", "0.2", "0.3", "0.4"} | ||
|
||
def test_multi_groupby(self): | ||
datasource = self.get_datasource_mock() | ||
pie_viz = viz.DistributionPieViz( | ||
datasource, {"metrics": ["floatcol"], "groupby": ["intcol", "strcol"]}, | ||
) | ||
data = pie_viz.get_data(self.base_df) | ||
assert self.get_cols(data) == {"1, a", "2, b", "3, c", "4, <NULL>", "<NULL>, d"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## master #10966 +/- ##
==========================================
- Coverage 65.80% 65.69% -0.11%
==========================================
Files 815 815
Lines 38327 38304 -23
Branches 3600 3600
==========================================
- Hits 25221 25165 -56
- Misses 13002 13032 +30
- Partials 104 107 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
9c28b84
to
fa3ec04
Compare
fa3ec04
to
ba75cdd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic! Happy to see more of viz.py go away, and this first drop-in replacement for NVD3! And tests in the more sensible place! So many good things happening here.
@ktmud / @kristw Please double check that this PR (and ones like it) won't break any use cases you're aware of. I would assume people will be excited to see this one landing though.
Thank you! The new pie chart looks so much beautifuler! |
* feat: introduce echarts pie chart * lint * remove viz.py shim * remove tests * fix cypress test * fix test
Roadmap: apache-superset/superset-roadmap#48 |
SUMMARY
Replace the existing NVD3 Pie chart with an ECharts based chart (see apache-superset/superset-ui#772) and bump
superset-ui
packages to0.15.3
. Also fixes color problems on boxplot and wordcloud.BEFORE
AFTER
TEST PLAN
ADDITIONAL INFORMATION