-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
fix(multiline): return all chart data on initial request #12660
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12660 +/- ##
==========================================
+ Coverage 64.55% 66.62% +2.06%
==========================================
Files 1018 1018
Lines 49787 49820 +33
Branches 4971 4877 -94
==========================================
+ Hits 32141 33193 +1052
+ Misses 17468 16504 -964
+ Partials 178 123 -55
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
853c71b
to
3cd726c
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.
One small optimization for performance. Probably doesn't really matter.
superset/viz.py
Outdated
from superset.charts.dao import ChartDAO | ||
|
||
axis1_charts = ChartDAO.find_by_ids(multiline_fd.get("line_charts", [])) | ||
axis2_charts = ChartDAO.find_by_ids(multiline_fd.get("line_charts_2", [])) |
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.
It might be possible to combine these two queries into one:
axis1_chart_ids = multiline_fd.get("line_charts", [])
axis2_chart_ids = multiline_fd.get("line_charts_2", [])
all_charts = ChartDAO.find_by_ids(axis1_chart_ids + axis2_chart_ids)
axis1_charts = all_charts[:len(axis1_chart_ids)]
axis2_charts = all_charts[len(axis1_chart_ids):]
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.
I did a slight variation of this to that doesn't fail if there are duplicates (shouldn't be the case, but you never know).
@villebro Should I do extra steps to make this working? When I open multiline chart I got this: |
@adam-stasiak that's peculiar, I wonder if your frontend assets are properly rebuilt? With the new version of the NVD3 package |
I rerun npm install and docker and now without an issue:) 🟢 |
* fix(multiline): return chart data on data request * bump package * optimize chart retrieval and fix chart form_data
SUMMARY
Move the multiline logic from frontend to backend to avoid multiple requests to the backend that were complicated by async framework. Frontend changes done here: apache-superset/superset-ui#899.
SCREENSHOT
TEST PLAN
Local testing
ADDITIONAL INFORMATION