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

fix(multiline): return all chart data on initial request #12660

Merged
merged 3 commits into from Jan 23, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Jan 21, 2021

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

image

TEST PLAN

Local testing

ADDITIONAL INFORMATION

@codecov-io
Copy link

codecov-io commented Jan 21, 2021

Codecov Report

Merging #12660 (e7bffc1) into master (5504762) will increase coverage by 2.06%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            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     
Flag Coverage Δ
cypress 50.96% <ø> (+13.75%) ⬆️
javascript 60.94% <ø> (ø)
python 63.62% <0.00%> (-0.51%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/viz.py 59.06% <0.00%> (-0.97%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-85.72%) ⬇️
superset/db_engine_specs/hive.py 54.61% <0.00%> (-29.24%) ⬇️
superset/db_engine_specs/presto.py 81.38% <0.00%> (-6.71%) ⬇️
superset/views/database/mixins.py 80.70% <0.00%> (-1.76%) ⬇️
superset/models/core.py 88.04% <0.00%> (-0.82%) ⬇️
...ard/components/nativeFilters/FilterConfigModal.tsx 69.31% <0.00%> (+0.16%) ⬆️
superset-frontend/src/SqlLab/actions/sqlLab.js 62.42% <0.00%> (+0.21%) ⬆️
.../explore/components/controls/DateFilterControl.jsx 56.32% <0.00%> (+0.57%) ⬆️
...perset-frontend/src/views/CRUD/chart/ChartList.tsx 81.88% <0.00%> (+0.78%) ⬆️
... and 129 more

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 5504762...e7bffc1. Read the comment docs.

@villebro villebro changed the title [WIP] fix(multiline): return chart data on data request fix(multiline): return chart data on data request Jan 22, 2021
@villebro villebro changed the title fix(multiline): return chart data on data request fix(multiline): return all chart data on initial request Jan 22, 2021
Copy link
Member

@ktmud ktmud left a 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", []))
Copy link
Member

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):]

Copy link
Member Author

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).

@adam-stasiak
Copy link
Contributor

@villebro Should I do extra steps to make this working? When I open multiline chart I got this:
image

@villebro
Copy link
Member Author

@adam-stasiak that's peculiar, I wonder if your frontend assets are properly rebuilt? With the new version of the NVD3 package axis1 shouldn't be present in the codebase any longer.

@junlincc junlincc self-requested a review January 22, 2021 15:22
@junlincc junlincc added viz:charts:multiline Related to the Multiline chart hold:testing! On hold for testing labels Jan 22, 2021
@adam-stasiak
Copy link
Contributor

I rerun npm install and docker and now without an issue:) 🟢

@junlincc junlincc added rush! Requires immediate attention v1.0.1 need:merge The PR is ready to be merged and removed hold:testing! On hold for testing labels Jan 22, 2021
@zhaoyongjie zhaoyongjie merged commit ede8790 into apache:master Jan 23, 2021
@junlincc junlincc removed need:merge The PR is ready to be merged rush! Requires immediate attention labels Jan 23, 2021
@villebro villebro deleted the villebro/multiline branch January 23, 2021 08:13
villebro added a commit that referenced this pull request Jan 25, 2021
* fix(multiline): return chart data on data request

* bump package

* optimize chart retrieval and fix chart form_data
@mistercrunch mistercrunch added 🍒 1.0.1 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 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 preset-io size/M v1.0.1 viz:charts:multiline Related to the Multiline chart 🍒 1.0.1 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Line_multi charts keeps refreshing after upgrade
7 participants