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

feat: advanced analytics for timeseries in echart viz #1170

Merged
merged 29 commits into from
Jul 28, 2021

Conversation

zhaoyongjie
Copy link
Contributor

@zhaoyongjie zhaoyongjie commented Jun 14, 2021

🏆 Enhancements
added advanced analytics in echart viz

server-side codes at: apache/superset#15279

YTD(year-to-date) + time shift

image

YoY(year-over-year) / MoM / QoQ ....

image

redesign

  1. redesign Time shifting on all time-series-like chart(currently only in time-series chart, but it is easy to migrate to others)

image

image

  1. rolling calculation on all time-series-like chart(currently only in time-series chart, but it is easy to migrate to others)

image

How to test it.

A. parpare codes

  1. pull associated PR in superset-ui: feat: advanced analytics for timeseries in echart viz #1170
  2. pull PR in superset: feat: run extra query on QueryObject and add compare operator for post_processing apache/superset#15279
  3. the directory like this:
$ tree -L 1
.
├── superset-ui
└── superset

B. Build superset-ui

run after commands in terminal

$ cd superset-ui
superset-ui$ yarn clean
superset-ui$ rm -rf ./{packages,plugins}/*/node_modules ./node_modules
superset-ui$ yarn clean-npm-lock

superset-ui$ yarn
superset-ui$ yarn build

C. Build superser-frontend

$ cd superser/superset-frontend
superset-frontend$ npm ci
superset-frontend$ npm link --legacy-peer-deps ../../superset-ui/plugins/plugin-chart-echarts/ ../../superset-ui/packages/superset-ui-chart-controls/ ../../superset-ui/packages/superset-ui-core/

D. Hack core module

  1. change package.json in superset-ui-core
diff --git a/packages/superset-ui-core/package.json b/packages/superset-ui-core/package.json
index 30a78f1e..a67dfd40 100644
--- a/packages/superset-ui-core/package.json
+++ b/packages/superset-ui-core/package.json
@@ -32,8 +32,6 @@
   },
   "dependencies": {
     "@babel/runtime": "^7.1.2",
-    "@emotion/cache": "^11.1.3",
-    "@emotion/react": "^11.1.5",
     "@emotion/styled": "^11.3.0",
     "@types/d3-format": "^1.3.0",
     "@types/d3-interpolate": "^1.3.1",
@@ -65,6 +63,8 @@
     "@types/react": "*",
     "@types/react-loadable": "*",
     "react": "^16.13.1",
-    "react-loadable": "^5.5.0"
+    "react-loadable": "^5.5.0",
+    "@emotion/cache": "^11.1.3",
+    "@emotion/react": "^11.1.5"
   }
 }
  1. build each package of superset-ui
$ cd superset-ui/packages/superset-ui-core/
superset-ui-core$ yarn

$ cd superset-ui/packages/superset-ui-chart-controls/
superset-ui-chart-controls$ yarn

$ cd superset-ui/plugins/plugin-chart-echarts/
plugin-chart-echarts$ yarn

E. run dev server in Superset

$ cd superset/superset-frontend
superset-frontend$ npm run dev-server

@vercel
Copy link

vercel bot commented Jun 14, 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/6fLMYj8nyDmnss4YP6o9GpgySoMR
✅ Preview: https://superset-ui-git-fork-zhaoyongjie-rollingtotal-superset.vercel.app

@codecov
Copy link

codecov bot commented Jul 2, 2021

Codecov Report

Merging #1170 (7005574) into master (9b92a69) will increase coverage by 0.47%.
The diff coverage is 95.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1170      +/-   ##
==========================================
+ Coverage   29.60%   30.07%   +0.47%     
==========================================
  Files         466      476      +10     
  Lines        9566     9628      +62     
  Branches     1572     1584      +12     
==========================================
+ Hits         2832     2896      +64     
  Misses       6505     6505              
+ Partials      229      227       -2     
Impacted Files Coverage Δ
packages/superset-ui-chart-controls/src/index.ts 100.00% <ø> (ø)
...perset-ui-chart-controls/src/sections/sections.tsx 100.00% <ø> (ø)
...ugin-chart-echarts/src/Timeseries/controlPanel.tsx 33.33% <ø> (ø)
.../plugin-chart-echarts/src/Timeseries/buildQuery.ts 25.00% <25.00%> (-29.55%) ⬇️
...t-ui-chart-controls/src/operators/pivotOperator.ts 100.00% <100.00%> (ø)
...rt-controls/src/operators/rollingWindowOperator.ts 100.00% <100.00%> (ø)
...et-ui-chart-controls/src/operators/sortOperator.ts 100.00% <100.00%> (ø)
...hart-controls/src/operators/timeCompareOperator.ts 100.00% <100.00%> (ø)
...controls/src/operators/timeComparePivotOperator.ts 100.00% <100.00%> (ø)
...ui-chart-controls/src/operators/utils/constants.ts 100.00% <100.00%> (ø)
... and 14 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 9b92a69...7005574. Read the comment docs.

@zhaoyongjie zhaoyongjie merged commit bb29965 into apache-superset:master Jul 28, 2021
stephenLYZ pushed a commit to stephenLYZ/superset-ui that referenced this pull request Aug 2, 2021
stephenLYZ pushed a commit to stephenLYZ/superset-ui that referenced this pull request Aug 2, 2021
@andrewscarani
Copy link

andrewscarani commented Sep 10, 2021

Hi @zhaoyongjie, I explicitly asked on this PR if this functionality would be added to the Mixed Time Series chart as well, but I'm not seeing that in Preset even a month later. Is there any way to easily add that in another PR?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants