Skip to content

Commit

Permalink
refactor: Migrates legacy Sunburst charts to ECharts and removes lega…
Browse files Browse the repository at this point in the history
…cy code (#26350)
  • Loading branch information
michael-s-molina committed Jan 18, 2024
1 parent cf20b34 commit 4d9144e
Show file tree
Hide file tree
Showing 32 changed files with 82 additions and 1,229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const WORLD_HEALTH_CHARTS = [
{ name: 'Most Populated Countries', viz: 'table' },
{ name: "World's Population", viz: 'big_number' },
{ name: 'Growth Rate', viz: 'line' },
{ name: 'Rural Breakdown', viz: 'sunburst' },
{ name: 'Rural Breakdown', viz: 'sunburst_v2' },
{ name: "World's Pop Growth", viz: 'area' },
{ name: 'Life Expectancy VS Rural %', viz: 'bubble' },
{ name: 'Treemap', viz: 'treemap_v2' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
*/
describe('Visualization > Sunburst', () => {
beforeEach(() => {
cy.intercept('POST', '/superset/explore_json/**').as('getJson');
cy.intercept('POST', '/api/v1/chart/data**').as('chartData');
});

const SUNBURST_FORM_DATA = {
datasource: '2__table',
viz_type: 'sunburst',
viz_type: 'sunburst_v2',
slice_id: 47,
granularity_sqla: 'year',
time_grain_sqla: 'P1D',
time_range: 'No filter',
groupby: ['region'],
columns: ['region'],
metric: 'sum__SP_POP_TOTL',
adhoc_filters: [],
row_limit: 50000,
Expand All @@ -37,32 +37,35 @@ describe('Visualization > Sunburst', () => {

function verify(formData) {
cy.visitChartByParams(formData);
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
cy.verifySliceSuccess({ waitAlias: '@chartData' });
}

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

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

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

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

it('should allow type to search color schemes', () => {
Expand Down
27 changes: 0 additions & 27 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"@superset-ui/legacy-plugin-chart-rose": "file:./plugins/legacy-plugin-chart-rose",
"@superset-ui/legacy-plugin-chart-sankey": "file:./plugins/legacy-plugin-chart-sankey",
"@superset-ui/legacy-plugin-chart-sankey-loop": "file:./plugins/legacy-plugin-chart-sankey-loop",
"@superset-ui/legacy-plugin-chart-sunburst": "file:./plugins/legacy-plugin-chart-sunburst",
"@superset-ui/legacy-plugin-chart-world-map": "file:./plugins/legacy-plugin-chart-world-map",
"@superset-ui/legacy-preset-chart-deckgl": "file:./plugins/legacy-preset-chart-deckgl",
"@superset-ui/legacy-preset-chart-nvd3": "file:./plugins/legacy-preset-chart-nvd3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ export const wordCloudFormData = {

export const sunburstFormData = {
datasource: '2__table',
viz_type: 'sunburst',
viz_type: 'sunburst_v2',
slice_id: 47,
url_params: {},
granularity_sqla: 'year',
time_grain_sqla: 'P1D',
time_range: '2011-01-01 : 2011-01-01',
groupby: ['region', 'country_name'],
columns: ['region', 'country_name'],
metric: 'sum__SP_POP_TOTL',
secondary_metric: 'sum__SP_RUR_TOTL',
adhoc_filters: [],
Expand Down
1 change: 0 additions & 1 deletion superset-frontend/packages/superset-ui-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"@superset-ui/legacy-plugin-chart-rose": "*",
"@superset-ui/legacy-plugin-chart-sankey": "*",
"@superset-ui/legacy-plugin-chart-sankey-loop": "*",
"@superset-ui/legacy-plugin-chart-sunburst": "*",
"@superset-ui/legacy-plugin-chart-time-table": "*",
"@superset-ui/legacy-plugin-chart-world-map": "*",
"@superset-ui/legacy-preset-chart-deckgl": "*",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
} from '@superset-ui/core';
import { BigNumberChartPlugin } from '@superset-ui/plugin-chart-echarts';
import LegacySankeyPlugin from '@superset-ui/legacy-plugin-chart-sankey';
import LegacySunburstPlugin from '@superset-ui/legacy-plugin-chart-sunburst';
import { WordCloudChartPlugin } from '@superset-ui/plugin-chart-word-cloud';

import {
Expand All @@ -50,8 +49,6 @@ new BigNumberChartPlugin().configure({ key: BIG_NUMBER }).register();
// eslint-disable-next-line
new LegacySankeyPlugin().configure({ key: SANKEY }).register();
// eslint-disable-next-line
new LegacySunburstPlugin().configure({ key: SUNBURST }).register();
// eslint-disable-next-line
new WordCloudChartPlugin().configure({ key: WORD_CLOUD }).register();

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

This file was deleted.

52 changes: 0 additions & 52 deletions superset-frontend/plugins/legacy-plugin-chart-sunburst/README.md

This file was deleted.

Loading

0 comments on commit 4d9144e

Please sign in to comment.