-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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: apply post processing to chart data #15843
feat: apply post processing to chart data #15843
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15843 +/- ##
==========================================
- Coverage 77.13% 76.88% -0.26%
==========================================
Files 984 985 +1
Lines 51706 51840 +134
Branches 6995 7037 +42
==========================================
- Hits 39882 39855 -27
- Misses 11600 11760 +160
- Partials 224 225 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
nice!
Hi @betodealmeida, Thanks for this improvement. But, please hold on to this PR. Can we do this by constructing a different query object on the front end? |
@zhaoyongjie I don't think we can. We would have to express the aggregation functions for the pivoting using the query context. For other text-based visualization like the t-test table it would also by really hard to express the statistical significance logic in a backend-agnostic query. What are your concerns here? |
Sorry for reply is a little late. The newest v1 API has |
Merging this even if it's not the ideal solution, since it's blocking some important work. Let's talk about this on the next meetup. |
@betodealmeida using this option on a pivot table v2 that has 'number' fields (in the group by) and using the CSV format, gives me the following error:
When selecting json format, it works fine. Removing the number fields seems to fix the issue. Is this a known problem/limitation? |
@betodealmeida I see it was fixed in #16259. |
* feat: apply post processing to chart data * Fix tests and lint * Fix lint * trigger tests
* feat: apply post processing to chart data * Fix tests and lint * Fix lint * trigger tests
* feat: apply post processing to chart data * Fix tests and lint * Fix lint * trigger tests
* feat: apply post processing to chart data * Fix tests and lint * Fix lint * trigger tests
SUMMARY
This PR introduces a new
ChartDataResultType
,ChartDataResultType.POST_PROCESSED
. It allows us to request the data for a given chart post-processed in the same way the visualization does in Javascript.Eg, for this pivot table:
Normally if we request the data for the chart we get the pre-processed (unpivoted) data.
Doing a
GET
on "http://localhost:9000/api/v1/chart/72/data/?format=json" returns:Note that the results above have 22 rows and 3 columns: "gender", "state", and "Birth" (the metric).
With this PR we can do a
GET
request to "http://localhost:9000/api/v1/chart/72/data/?format=json&type=post_processed" to get:Note that we now get the correct results, with 3 rows and many columns from the pivot.
This functionality was added to support a very small subset of visualization types:
Because of the small number of visualization types, I opted to do this by reimplementing the chart logic in Python. The alternative would be to run the visualization under Selenium and scrape the data, which is inefficient and still requires keeping the scraping logic up-to-date with the plugins.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Create and save a pivot chart (not v2). Check the data at "http://localhost:9000/api/v1/chart/{chartid}/data/?format=json&type=post_processed" and "http://localhost:9000/api/v1/chart/{chartid}/data/?format=json&type=full".
ADDITIONAL INFORMATION