feat(echarts-funnel): Implement % calculation type#26290
feat(echarts-funnel): Implement % calculation type#26290kgabryje merged 3 commits intoapache:masterfrom
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #26290 +/- ##
=======================================
Coverage 69.18% 69.18%
=======================================
Files 1945 1945
Lines 75971 75981 +10
Branches 8467 8474 +7
=======================================
+ Hits 52559 52566 +7
Misses 21225 21225
- Partials 2187 2190 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
eschutho
left a comment
There was a problem hiding this comment.
Looks great! Thanks for including the migration timings, too.
villebro
left a comment
There was a problem hiding this comment.
Great improvement! Small theoretical scalability improvement for the migration, other than that LGTM
There was a problem hiding this comment.
nit: maybe this slightly shortens it, although it's maybe less explicit..
| index === 0 ? 1 : value / (data[index - 1][metricLabel] as number); | |
| index ? value / (data[index - 1][metricLabel] as number) : 1; |
There was a problem hiding this comment.
TBH in case such as this, I think it's better to be explicit that we perform an operation only for the first element of an array, rather than when "index is not falsy"
There was a problem hiding this comment.
Yes, very good point. This was mostly a knee-jerk reaction that I often get when I get when I see something that can be shortened with truthy/falsy checking. Carry on 👍
There was a problem hiding this comment.
Could we use paginated_update here? I'm not expecting people to have 100k funnel charts, but as a principle, I think it's a good idea to always paginate updates when possible.
cb5d447 to
8586275
Compare
villebro
left a comment
There was a problem hiding this comment.
We should remove the explicit commit, as that's already happening in the paginator
| if not percent_calculation: | ||
| params["percent_calculation_type"] = "total" | ||
| slc.params = json.dumps(params) | ||
| session.commit() |
There was a problem hiding this comment.
I don't think we should be committing on the changes (paginated_update should do that for us)
| session.commit() |
| if percent_calculation: | ||
| del params["percent_calculation_type"] | ||
| slc.params = json.dumps(params) | ||
| session.commit() |
There was a problem hiding this comment.
same here
| session.commit() |
TIL 🙂 done |
SUMMARY
Add "% Calculation" field to Funnel chart's control panel. Currently, the % of each level of funnel chart is calculated as % of total. This PR allows user to also display % of each level as % of the first step or % of previous step.
Example of calculations:
The default value for new charts is "Calculate from first step". For existing charts, a migration was added to keep "Percent of total" as selected option.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
Current: 0.21 s
10+: 0.21 s
100+: 0.12 s
1000+: 0.13 s