fix: the legend does not preserves the order of metrics
SUMMARY
fix https://github.com/apache/superset/issues/22162 Pandas pivot_table modifies the order of columns. Reorder the table columns to preserve the legend order
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in SIP-59)
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
我认为此更改没有意义,因为在这些更改之后,无法手动重新排序指标。
有什么设置可以使legend的顺序与metrics的顺序相同么? 文档中没有找到. 折线图里调整metrics之后,legend就会被按照字母顺序排列.(我并不熟练,只是目前需要去维护于此相关的项目)
手动调整顺序, 即metrics control里面的metrics可以手动调整顺序.
手动调整顺序, 即metrics control里面的metrics可以手动调整顺序.
您的意思的是调整这里的顺序吗? 但是在折线图中调整这里的顺序,legend仍然会被重排为字母顺序

手动调整顺序, 即metrics control里面的metrics可以手动调整顺序.
您的意思的是调整这里的顺序吗? 但是在折线图中调整这里的顺序,legend仍然会被重排为字母顺序
我刚明白, 您如果只关心Legend顺序, 那么这是个前端问题, 你需要修改前端的line-chart plugins. 而不是修改post_processing operator.
感谢 我再去看看
Codecov Report
Attention: 2 lines in your changes are missing coverage. Please review.
Comparison is base (
17c2bd8) 66.99% compared to head (9154a4f) 54.22%. Report is 1939 commits behind head on master.
| Files | Patch % | Lines |
|---|---|---|
| superset/utils/pandas_postprocessing/pivot.py | 0.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #22164 +/- ##
===========================================
- Coverage 66.99% 54.22% -12.78%
===========================================
Files 1833 2011 +178
Lines 69936 91477 +21541
Branches 7572 7572
===========================================
+ Hits 46855 49604 +2749
- Misses 21121 39913 +18792
Partials 1960 1960
| Flag | Coverage Δ | |
|---|---|---|
| hive | 54.37% <0.00%> (+1.76%) |
:arrow_up: |
| mysql | ? |
|
| postgres | ? |
|
| presto | 53.72% <0.00%> (+1.23%) |
:arrow_up: |
| python | 54.51% <0.00%> (-26.88%) |
:arrow_down: |
| sqlite | ? |
|
| unit | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Looks like this PR needs further discussion and touch-ups to pass CI. I'll convert it to draft for now. Please re-open when it is read for re-review, and we can merge it if people are aligned on the approach/solution. Thanks!
Codecov Report
Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.
Project coverage is 54.22%. Comparing base (
17c2bd8) to head (9154a4f). Report is 2459 commits behind head on master.
| Files | Patch % | Lines |
|---|---|---|
| superset/utils/pandas_postprocessing/pivot.py | 0.00% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #22164 +/- ##
===========================================
- Coverage 66.99% 54.22% -12.78%
===========================================
Files 1833 2011 +178
Lines 69936 91477 +21541
Branches 7572 7572
===========================================
+ Hits 46855 49604 +2749
- Misses 21121 39913 +18792
Partials 1960 1960
| Flag | Coverage Δ | |
|---|---|---|
| hive | 54.37% <0.00%> (+1.76%) |
:arrow_up: |
| mysql | ? |
|
| postgres | ? |
|
| presto | 53.72% <0.00%> (+1.23%) |
:arrow_up: |
| python | 54.51% <0.00%> (-26.88%) |
:arrow_down: |
| sqlite | ? |
|
| unit | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.