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(plugin-chart-echarts): fix forecasts on verbose metrics #18252

Merged
merged 3 commits into from
Feb 2, 2022

Conversation

villebro
Copy link
Member

@villebro villebro commented Feb 2, 2022

SUMMARY

This fixes a bug in the ECharts timeseries chart, where using a metric with a verbose name caused the forecast and observations to be on separate series (one with the verbose name, and the other with the raw name). A test is also added that ensures verbose names are correctly handled going forward. In addition, all references to "prophet" are replaced with "forecast" in preparation for decoupling the forecasting functionality from Prophet.

AFTER

Now the metric with a verbose name displays correctly in both the chart and the tooltip:
image

The forecast section is also split up into one control per line:
image

BEFORE

Previously, the predictions would show up as different series with their non-verbose name, both on the chart and the tooltip
image

Before, the forecast section headers wrapping caused the controls to be misaligned:
image

TESTING INSTRUCTIONS

  1. Create a v2 Line chart
  2. Add the built-in COUNT(*) metric as your primary metric
  3. Enable the forecast

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

@kgabryje
Copy link
Member

kgabryje commented Feb 2, 2022

The fix doesn't seem to be working well with GENERIC_CHART_AXES ff disabled - Y axis is scaled to timestamp epoch values

image

@villebro
Copy link
Member Author

villebro commented Feb 2, 2022

The fix doesn't seem to be working well with GENERIC_CHART_AXES ff disabled - Y axis is scaled to timestamp epoch values

Great catch! It turns out datasource.verboseMap always includes an entry { __timestamp: 'Time' } which threw the util function off when it was made more generic. I added added a check for it + added a test for making sure the alias stays unchanged (this logic will be removed once we remove the legacy non-generic timeseries functionality).

@kgabryje
Copy link
Member

kgabryje commented Feb 2, 2022

Retested, works perfectly with and without GENERIC_CHART_AXES!
image

image

@codecov
Copy link

codecov bot commented Feb 2, 2022

Codecov Report

Merging #18252 (2a4dde5) into master (8c37654) will increase coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #18252   +/-   ##
=======================================
  Coverage   66.32%   66.32%           
=======================================
  Files        1592     1592           
  Lines       62569    62569           
  Branches     6295     6295           
=======================================
+ Hits        41500    41501    +1     
  Misses      19416    19416           
+ Partials     1653     1652    -1     
Flag Coverage Δ
javascript 51.38% <50.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...i-chart-controls/src/sections/forecastInterval.tsx 100.00% <ø> (ø)
...hart-echarts/src/MixedTimeseries/transformProps.ts 0.00% <0.00%> (ø)
...lugin-chart-echarts/src/Timeseries/transformers.ts 50.83% <ø> (ø)
...frontend/plugins/plugin-chart-echarts/src/types.ts 100.00% <ø> (ø)
...gin-chart-echarts/src/Timeseries/transformProps.ts 58.06% <14.28%> (ø)
...plugins/plugin-chart-echarts/src/utils/forecast.ts 94.82% <93.33%> (ø)

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 8c37654...2a4dde5. Read the comment docs.

@villebro villebro merged commit 2929bb1 into apache:master Feb 2, 2022
@villebro villebro deleted the villebro/verbose-forecast-name branch February 2, 2022 13:14
shcoderAlex pushed a commit to casual-precision/superset that referenced this pull request Feb 7, 2022
…8252)

* fix(plugin-chart-echarts): fix forecasts on verbose metrics

* oops! 🙊

* check for DTTM_ALIAS
ofekisr pushed a commit to nielsen-oss/superset that referenced this pull request Feb 8, 2022
…8252)

* fix(plugin-chart-echarts): fix forecasts on verbose metrics

* oops! 🙊

* check for DTTM_ALIAS
bwang221 pushed a commit to casual-precision/superset that referenced this pull request Feb 10, 2022
…8252)

* fix(plugin-chart-echarts): fix forecasts on verbose metrics

* oops! 🙊

* check for DTTM_ALIAS
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 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/L 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants