Skip to content

Commit 4d9144e

Browse files
refactor: Migrates legacy Sunburst charts to ECharts and removes legacy code (#26350)
1 parent cf20b34 commit 4d9144e

File tree

32 files changed

+82
-1229
lines changed

32 files changed

+82
-1229
lines changed

superset-frontend/cypress-base/cypress/e2e/dashboard/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const WORLD_HEALTH_CHARTS = [
2525
{ name: 'Most Populated Countries', viz: 'table' },
2626
{ name: "World's Population", viz: 'big_number' },
2727
{ name: 'Growth Rate', viz: 'line' },
28-
{ name: 'Rural Breakdown', viz: 'sunburst' },
28+
{ name: 'Rural Breakdown', viz: 'sunburst_v2' },
2929
{ name: "World's Pop Growth", viz: 'area' },
3030
{ name: 'Life Expectancy VS Rural %', viz: 'bubble' },
3131
{ name: 'Treemap', viz: 'treemap_v2' },

superset-frontend/cypress-base/cypress/e2e/explore/visualizations/sunburst.test.js

+17-14
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
*/
1919
describe('Visualization > Sunburst', () => {
2020
beforeEach(() => {
21-
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
21+
cy.intercept('POST', '/api/v1/chart/data**').as('chartData');
2222
});
2323

2424
const SUNBURST_FORM_DATA = {
2525
datasource: '2__table',
26-
viz_type: 'sunburst',
26+
viz_type: 'sunburst_v2',
2727
slice_id: 47,
2828
granularity_sqla: 'year',
2929
time_grain_sqla: 'P1D',
3030
time_range: 'No filter',
31-
groupby: ['region'],
31+
columns: ['region'],
3232
metric: 'sum__SP_POP_TOTL',
3333
adhoc_filters: [],
3434
row_limit: 50000,
@@ -37,32 +37,35 @@ describe('Visualization > Sunburst', () => {
3737

3838
function verify(formData) {
3939
cy.visitChartByParams(formData);
40-
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
40+
cy.verifySliceSuccess({ waitAlias: '@chartData' });
4141
}
4242

43-
it('should work without secondary metric', () => {
43+
// requires the ability to render charts using SVG only for tests
44+
it.skip('should work without secondary metric', () => {
4445
verify(SUNBURST_FORM_DATA);
45-
// There should be 7 visible arcs + 1 hidden
46-
cy.get('.chart-container svg g#arcs path').should('have.length', 8);
46+
cy.get('.chart-container svg g path').should('have.length', 7);
4747
});
4848

49-
it('should work with secondary metric', () => {
49+
// requires the ability to render charts using SVG only for tests
50+
it.skip('should work with secondary metric', () => {
5051
verify({
5152
...SUNBURST_FORM_DATA,
5253
secondary_metric: 'sum__SP_RUR_TOTL',
5354
});
54-
cy.get('.chart-container svg g#arcs path').should('have.length', 8);
55+
cy.get('.chart-container svg g path').should('have.length', 7);
5556
});
5657

57-
it('should work with multiple groupbys', () => {
58+
// requires the ability to render charts using SVG only for tests
59+
it.skip('should work with multiple columns', () => {
5860
verify({
5961
...SUNBURST_FORM_DATA,
60-
groupby: ['region', 'country_name'],
62+
columns: ['region', 'country_name'],
6163
});
62-
cy.get('.chart-container svg g#arcs path').should('have.length', 117);
64+
cy.get('.chart-container svg g path').should('have.length', 221);
6365
});
6466

65-
it('should work with filter', () => {
67+
// requires the ability to render charts using SVG only for tests
68+
it.skip('should work with filter', () => {
6669
verify({
6770
...SUNBURST_FORM_DATA,
6871
adhoc_filters: [
@@ -77,7 +80,7 @@ describe('Visualization > Sunburst', () => {
7780
},
7881
],
7982
});
80-
cy.get('.chart-container svg g#arcs path').should('have.length', 3);
83+
cy.get('.chart-container svg g path').should('have.length', 2);
8184
});
8285

8386
it('should allow type to search color schemes', () => {

superset-frontend/package-lock.json

-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

superset-frontend/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
106106
"@superset-ui/legacy-plugin-chart-sankey": "file:./plugins/legacy-plugin-chart-sankey",
107107
"@superset-ui/legacy-plugin-chart-sankey-loop": "file:./plugins/legacy-plugin-chart-sankey-loop",
108-
"@superset-ui/legacy-plugin-chart-sunburst": "file:./plugins/legacy-plugin-chart-sunburst",
109108
"@superset-ui/legacy-plugin-chart-world-map": "file:./plugins/legacy-plugin-chart-world-map",
110109
"@superset-ui/legacy-preset-chart-deckgl": "file:./plugins/legacy-preset-chart-deckgl",
111110
"@superset-ui/legacy-preset-chart-nvd3": "file:./plugins/legacy-preset-chart-nvd3",

superset-frontend/packages/superset-ui-core/test/chart/fixtures/formData.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ export const wordCloudFormData = {
5656

5757
export const sunburstFormData = {
5858
datasource: '2__table',
59-
viz_type: 'sunburst',
59+
viz_type: 'sunburst_v2',
6060
slice_id: 47,
6161
url_params: {},
6262
granularity_sqla: 'year',
6363
time_grain_sqla: 'P1D',
6464
time_range: '2011-01-01 : 2011-01-01',
65-
groupby: ['region', 'country_name'],
65+
columns: ['region', 'country_name'],
6666
metric: 'sum__SP_POP_TOTL',
6767
secondary_metric: 'sum__SP_RUR_TOTL',
6868
adhoc_filters: [],

superset-frontend/packages/superset-ui-demo/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
"@superset-ui/legacy-plugin-chart-rose": "*",
8181
"@superset-ui/legacy-plugin-chart-sankey": "*",
8282
"@superset-ui/legacy-plugin-chart-sankey-loop": "*",
83-
"@superset-ui/legacy-plugin-chart-sunburst": "*",
8483
"@superset-ui/legacy-plugin-chart-time-table": "*",
8584
"@superset-ui/legacy-plugin-chart-world-map": "*",
8685
"@superset-ui/legacy-preset-chart-deckgl": "*",

superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-sunburst/Stories.tsx

-63
This file was deleted.

superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-plugin-chart-sunburst/data.ts

-32
This file was deleted.

superset-frontend/packages/superset-ui-demo/storybook/stories/superset-ui-chart/ChartDataProviderStories.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
} from '@superset-ui/core';
2828
import { BigNumberChartPlugin } from '@superset-ui/plugin-chart-echarts';
2929
import LegacySankeyPlugin from '@superset-ui/legacy-plugin-chart-sankey';
30-
import LegacySunburstPlugin from '@superset-ui/legacy-plugin-chart-sunburst';
3130
import { WordCloudChartPlugin } from '@superset-ui/plugin-chart-word-cloud';
3231

3332
import {
@@ -50,8 +49,6 @@ new BigNumberChartPlugin().configure({ key: BIG_NUMBER }).register();
5049
// eslint-disable-next-line
5150
new LegacySankeyPlugin().configure({ key: SANKEY }).register();
5251
// eslint-disable-next-line
53-
new LegacySunburstPlugin().configure({ key: SUNBURST }).register();
54-
// eslint-disable-next-line
5552
new WordCloudChartPlugin().configure({ key: WORD_CLOUD }).register();
5653

5754
const VIS_TYPES = [BIG_NUMBER, SANKEY, SUNBURST, WORD_CLOUD, WORD_CLOUD_LEGACY];

superset-frontend/plugins/legacy-plugin-chart-sunburst/CHANGELOG.md

-35
This file was deleted.

superset-frontend/plugins/legacy-plugin-chart-sunburst/README.md

-52
This file was deleted.

0 commit comments

Comments
 (0)