Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

feat(plugin-chart-echarts): add support for custom forecasts #1389

Merged
merged 1 commit into from
Oct 6, 2021

Conversation

villebro
Copy link
Contributor

@villebro villebro commented Oct 5, 2021

🏆 Enhancements

The need to be able to create custom forecasts (without Prophet) has come up. In order to make this possible, we will assume that a forecast is present if there is a series with the forecast suffix (__yhat, __yhat_lower or __yhat_upper).

This is an intermediate step to decouple forecasts from Prophet - ultimately we should refactor the code in the following ways:

  • move the relevant utilities/types from plugin-chart-echarts to superset-ui/core
  • add support for other suffixes to make it possible to do similar inference from time offset series etc. Example: my_metric could be accompanied by my_metric__offset(PT1D) which could then be shown in the legend (with translations) as "my metric (1 day time offset)" or similar.
  • Add documentation for how these can be used.

SCREENSHOTS

Notice, that I haven't enabled forecasting, yet I'm able to create a chart with a forecast and confidence interval by applying the necessary suffixes to the series names:
image

@villebro villebro requested a review from a team as a code owner October 5, 2021 12:24
@vercel
Copy link

vercel bot commented Oct 5, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/superset/superset-ui/79mEzDz7q9hiKFjVpJ3Bd9AxJsrY
✅ Preview: https://superset-ui-git-fork-preset-io-villebro-forecast-abc-superset.vercel.app

@codecov
Copy link

codecov bot commented Oct 5, 2021

Codecov Report

Merging #1389 (f26c6f5) into master (63c9ca6) will increase coverage by 0.06%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1389      +/-   ##
==========================================
+ Coverage   30.34%   30.41%   +0.06%     
==========================================
  Files         497      497              
  Lines        9979     9990      +11     
  Branches     1680     1684       +4     
==========================================
+ Hits         3028     3038      +10     
- Misses       6706     6707       +1     
  Partials      245      245              
Impacted Files Coverage Δ
...lugin-chart-echarts/src/Timeseries/transformers.ts 44.14% <20.00%> (-0.31%) ⬇️
...gin-chart-echarts/src/Timeseries/transformProps.ts 55.12% <100.00%> (+1.18%) ⬆️
plugins/plugin-chart-echarts/src/utils/prophet.ts 92.98% <100.00%> (+2.78%) ⬆️
...ackages/superset-ui-core/src/utils/featureFlags.ts 100.00% <0.00%> (ø)
...ns/legacy-plugin-chart-histogram/src/Histogram.jsx 0.00% <0.00%> (ø)
...egacy-plugin-chart-histogram/src/transformProps.js 0.00% <0.00%> (ø)

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 63c9ca6...f26c6f5. Read the comment docs.

@BillGreerUX
Copy link

Thank you, this fits our use-case we requested to allow us to create custom forecasts without Prophet.

Copy link
Contributor

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got a weird area when create a custom forecasts

image

@villebro
Copy link
Contributor Author

villebro commented Oct 6, 2021

I got a weird area when create a custom forecasts

image

Oh, I think it's because your lower bound (SUM(num) * 1.2) is above the upper bound (SUM(num) * 1.1).

Copy link
Contributor

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested in local. LGTM

image

@zhaoyongjie
Copy link
Contributor

I got a weird area when create a custom forecasts
image

Oh, I think it's because your lower bound (SUM(num) * 1.2) is above the upper bound (SUM(num) * 1.1).

Thanks! You are right.

@villebro villebro merged commit 86e2fb0 into apache-superset:master Oct 6, 2021
@villebro villebro deleted the villebro/forecast-abc branch October 6, 2021 06:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants