feat: add ECharts Pie chart (#10966)

* feat: introduce echarts pie chart

* lint

* remove viz.py shim

* remove tests

* fix cypress test

* fix test
This commit is contained in:
Ville Brofeldt 2020-09-22 19:27:40 +03:00 committed by GitHub
parent 0554c8918e
commit a9eab33d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 195 additions and 295 deletions

View File

@ -38,18 +38,18 @@ describe('Visualization > Pie', () => {
function verify(formData) {
cy.visitChartByParams(JSON.stringify(formData));
cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' });
cy.verifySliceSuccess({ waitAlias: '@getJson' });
}
beforeEach(() => {
cy.server();
cy.login();
cy.route('POST', '/superset/explore_json/**').as('getJson');
cy.route('POST', '/api/v1/chart/data').as('getJson');
});
it('should work with ad-hoc metric', () => {
verify(PIE_FORM_DATA);
cy.get('.chart-container .nv-pie .nv-slice path').should('have.length', 2);
cy.get('.chart-container .pie canvas').should('have.length', 1);
});
it('should work with simple filter', () => {
@ -67,6 +67,6 @@ describe('Visualization > Pie', () => {
},
],
});
cy.get('.chart-container .nv-pie .nv-slice path').should('have.length', 1);
cy.get('.chart-container .pie canvas').should('have.length', 1);
});
});

View File

@ -3390,16 +3390,6 @@
"lodash": "^4.0.8"
}
},
"aphrodite": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/aphrodite/-/aphrodite-1.2.5.tgz",
"integrity": "sha1-g1jDbIC7A67puXFlqqcBhiJbSYM=",
"requires": {
"asap": "^2.0.3",
"inline-style-prefixer": "^3.0.1",
"string-hash": "^1.1.3"
}
},
"immutable": {
"version": "3.8.2",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz",
@ -15216,19 +15206,19 @@
}
},
"@superset-ui/chart-controls": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/chart-controls/-/chart-controls-0.15.1.tgz",
"integrity": "sha512-U2SBqi/7khdU2pQ6pT7ekzO2CeMhjs1YkN98hUyijYon6C7eneWHRuJ6KCsLYJ3pxQM8dyoe0vUfuc40HaKt7g==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/chart-controls/-/chart-controls-0.15.3.tgz",
"integrity": "sha512-ec76ogkTiiixMTk6Rwa2boEtksq/Gh2O9W+gamuUeFxyXUCHNEJPHGnm/RPoN/+ULAMAUBApRe6h+fGHvD0FIw==",
"requires": {
"@superset-ui/core": "0.15.1",
"@superset-ui/core": "0.15.2",
"lodash": "^4.17.15",
"prop-types": "^15.7.2"
}
},
"@superset-ui/core": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/core/-/core-0.15.1.tgz",
"integrity": "sha512-RfP9kJ4BhcN+i9OzNv0FicazUTUnqBih7yyd6tmoX+/JxH78LrHIit7EXekzjFkcMk33yr6ociQ4M85zM4ZGlA==",
"version": "0.15.2",
"resolved": "https://registry.npmjs.org/@superset-ui/core/-/core-0.15.2.tgz",
"integrity": "sha512-NZngspkaov9T7n5s5F9biADSS/noFLdRdQfGrd3p6KI8pkwksOEy/XxuVzbQ4/f0z8jGtzt5LYM0kYlV+8MqrQ==",
"requires": {
"@babel/runtime": "^7.1.2",
"@emotion/core": "^10.0.28",
@ -15299,10 +15289,12 @@
}
},
"@superset-ui/legacy-plugin-chart-calendar": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-calendar/-/legacy-plugin-chart-calendar-0.15.1.tgz",
"integrity": "sha512-+boW1QRRjON/NaAMh9akR4lNm48wN72b6YmopXW1l0L8/mr0iUefj5Gsw5GOT1OFfLZTTnhE3SU947vZFIu5kQ==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-calendar/-/legacy-plugin-chart-calendar-0.15.3.tgz",
"integrity": "sha512-LnqdVYfvlJPH3TiipIrNp1XXl4k8pzsnafU6vwlR9C672ld1iIA+4gFPg8DmO8aWkVfH4p67HpMr66kvdPZxxg==",
"requires": {
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3-array": "^2.0.3",
"d3-selection": "^1.4.0",
"d3-tip": "^0.9.1",
@ -15317,24 +15309,24 @@
}
},
"@superset-ui/legacy-plugin-chart-chord": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-chord/-/legacy-plugin-chart-chord-0.15.1.tgz",
"integrity": "sha512-/Nzn3ssLkoP3mGmtPso2vBnUNXh1b3woRG6iE8FOH84cNyFvRu7JoHShyUmgK5bbiCU0xhYfvdZ1XCThdkZiOw==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-chord/-/legacy-plugin-chart-chord-0.15.3.tgz",
"integrity": "sha512-2W5+sPu4KqRDSCGJ+h9nZAMJ5utS727YvpO8CZtPPhyOPsSnm+XPLgqwhIPeb6BkBS7bpLYnaoRrtb+1KS7WVw==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"prop-types": "^15.6.2",
"react": "^16.13.1"
}
},
"@superset-ui/legacy-plugin-chart-country-map": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-country-map/-/legacy-plugin-chart-country-map-0.15.1.tgz",
"integrity": "sha512-W9VDyliJucI+Uj40R7n4axAMiq1zZzK4xBOLDtMZ+M+B1VASy2Q12hKaFosNlX+7YoiWJtJvL81on6IQObqP0g==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-country-map/-/legacy-plugin-chart-country-map-0.15.3.tgz",
"integrity": "sha512-Hwbf0qLn/fqRx6zfBptBrbf/XbkneHXevIimqArx7ZJksdNs4AX+lXCnd0eaKZZ6f4wj9sJqtEUImq2lnJlaMQ==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"d3-array": "^2.0.3",
"prop-types": "^15.6.2"
@ -15348,32 +15340,34 @@
}
},
"@superset-ui/legacy-plugin-chart-event-flow": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-event-flow/-/legacy-plugin-chart-event-flow-0.15.1.tgz",
"integrity": "sha512-3251PaNwN3O5ClhDA34wG8kVVfNFyglIhmMj/zi+3cE9phR+UyUUvJjsCQUigsYBAaaNOEPgjEW+rkXz6jctXA==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-event-flow/-/legacy-plugin-chart-event-flow-0.15.3.tgz",
"integrity": "sha512-Tc4zmUFF5ts1ZE77cQxGmh0hPd4CMJhBQGAwgy0vQYLoebEYg3O14s8nxFsrkL/6769XAFKE/QFpu9H4uYBEiQ==",
"requires": {
"@data-ui/event-flow": "^0.0.84",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-force-directed": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-force-directed/-/legacy-plugin-chart-force-directed-0.15.1.tgz",
"integrity": "sha512-NNwiHnHTfsLJpGB9zHDO9FjywzMmGRl9WSe4VDUASAK/U8WR9JamfkBPrgidkHBbFC67uj3PBH1IOZzvnp+wJw==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-force-directed/-/legacy-plugin-chart-force-directed-0.15.3.tgz",
"integrity": "sha512-C358gibGgcqCXsX9MPolJR6rWNkqkxx8CtATIdHcm7kM8iksDDK0qe/TepDtC4C9y2Nlja8tIJ9hHAp71kEv6Q==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"prop-types": "^15.7.2"
}
},
"@superset-ui/legacy-plugin-chart-heatmap": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-heatmap/-/legacy-plugin-chart-heatmap-0.15.1.tgz",
"integrity": "sha512-gguXPtkurIsaqGy0rvgbQ2nkam45BNngUuIg/QIKFl4MK0LZGi1A3y7DVfPZfiZ40r9KRAbLaCmHwUhoDA7Opw==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-heatmap/-/legacy-plugin-chart-heatmap-0.15.3.tgz",
"integrity": "sha512-umEFKoNIHtyOmvuOnm6fUDwMzxXxwoiDOLTfPJVE86EsmwtsMzh6Vgdcx6AbczPLFj5yY2JKZzmFm9DbZdRE7w==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"d3-svg-legend": "^1.x",
"d3-tip": "^0.9.1",
@ -15381,14 +15375,14 @@
}
},
"@superset-ui/legacy-plugin-chart-histogram": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-histogram/-/legacy-plugin-chart-histogram-0.15.1.tgz",
"integrity": "sha512-v3qLHo8dwCCQYovHKGI8+M6344cELJnRtrPok8Z7t8+j1P8pf7CzBJ4ilee5Sf16aL2ceVg5gdA9QrY+hP5BqA==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-histogram/-/legacy-plugin-chart-histogram-0.15.3.tgz",
"integrity": "sha512-vGS8njQMHtCzHKA83YbHdvEixtnPBfLJ3nrik4W+NchYtYCYNX4Opd+DsEA/W/5oN5Wq4iMPKfQn9XWr7g1bUg==",
"requires": {
"@data-ui/histogram": "^0.0.84",
"@data-ui/theme": "^0.0.84",
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"@vx/legend": "^0.0.198",
"@vx/responsive": "^0.0.197",
"@vx/scale": "^0.0.197",
@ -15456,12 +15450,12 @@
}
},
"@superset-ui/legacy-plugin-chart-horizon": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-horizon/-/legacy-plugin-chart-horizon-0.15.1.tgz",
"integrity": "sha512-aqWOZdNCJxKQ/lbWad3WoIs3GUKarpR2U1IWdfPQi4FKEx/Q0WfXcmeWALqEE2HeKsvhyShvd5DaSLoZnvUkgw==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-horizon/-/legacy-plugin-chart-horizon-0.15.3.tgz",
"integrity": "sha512-YoONlng3uvUsAC1mb0Ux0rx71yevg8CPLj9d69JXa0Befz6H31bx+3n9B1sil0hg6eoxSsWhU+U8ikCD1cb/zQ==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3-array": "^2.0.3",
"d3-scale": "^3.0.1",
"prop-types": "^15.6.2"
@ -15487,12 +15481,12 @@
}
},
"@superset-ui/legacy-plugin-chart-map-box": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-map-box/-/legacy-plugin-chart-map-box-0.15.1.tgz",
"integrity": "sha512-X1GZLGWS9UI2H4rc/lOL/Im9UJNzRhqcekmGmdLyAtONprwvQzPox6/x0Jen2unENunxE3kWTCHsSAL+Q6nZ8A==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-map-box/-/legacy-plugin-chart-map-box-0.15.3.tgz",
"integrity": "sha512-ELmvfpyJpJUdj81MP3B85KLqxhX33kCqIXCdp1zboPS5r+1PpUqzZAm/9Xw32zUW1zUkBKHfAeRpMCxMEzJzFA==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"immutable": "^3.8.2",
"mapbox-gl": "^0.53.0",
"prop-types": "^15.6.2",
@ -15509,12 +15503,12 @@
}
},
"@superset-ui/legacy-plugin-chart-paired-t-test": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-paired-t-test/-/legacy-plugin-chart-paired-t-test-0.15.1.tgz",
"integrity": "sha512-u2N3LgtdNSkZTIo4bnXyzI/4Avfkv4lE+1kW/OT/GgzxKQ9yNRiS/zAN3X5Ws+dJ3Ca4cUSusTnX9dG+iUN34g==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-paired-t-test/-/legacy-plugin-chart-paired-t-test-0.15.3.tgz",
"integrity": "sha512-v0dTCFdP6enzmn7YBD5L5U9pPk/UPWl7udJlyD4IM+n8M13FirqYrWZkgLZ2FxuqmXRNXJ4haUj+EN3l41k/Gg==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"distributions": "^1.0.0",
"prop-types": "^15.6.2",
"reactable-arc": "0.15.0"
@ -15528,104 +15522,106 @@
}
},
"@superset-ui/legacy-plugin-chart-parallel-coordinates": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-parallel-coordinates/-/legacy-plugin-chart-parallel-coordinates-0.15.1.tgz",
"integrity": "sha512-SyyfGosnK1GPzjY8FR2heU5Gr6c6mRYlk9CI9EA/daQtxJ6A7UXUZiBtxgPKMBURC1KBu1ife0uCvt3ebhMN3g==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-parallel-coordinates/-/legacy-plugin-chart-parallel-coordinates-0.15.3.tgz",
"integrity": "sha512-tdvOZ/dFJDxNye3k+7ZjUZSMHpDv8lf0fi7YOkXce+PzzmQdsLZGHSerSA81vBS/aTcFG8k9jOx6KuYz7jdiFQ==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"prop-types": "^15.7.2"
}
},
"@superset-ui/legacy-plugin-chart-partition": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-partition/-/legacy-plugin-chart-partition-0.15.1.tgz",
"integrity": "sha512-q5wD3N4W4YsrsQA18Hgw/5kwfdmAkdh0pOcVh7i5yazP7+P3NU1Km0J6z98dfsv9U/zEHRPcbs+BcFcmgBEG7A==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-partition/-/legacy-plugin-chart-partition-0.15.3.tgz",
"integrity": "sha512-22CNkPlYqaKszcQcVPmWe5AAuBO93v0+NZD1nopbLTb1Rjkf48rkc9S+t/w0L272V14tfeS6kRPxHfsWsZgcmg==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"d3-hierarchy": "^1.1.8",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-pivot-table": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-pivot-table/-/legacy-plugin-chart-pivot-table-0.15.1.tgz",
"integrity": "sha512-2Qed/pQPDoHd2N/CC29LmXWRw656bBn1UIC/Kzk39mOMcV4/BhJVPqonGzxn/Yyu79AvwEI1bYgmgg8I+NMxbA==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-pivot-table/-/legacy-plugin-chart-pivot-table-0.15.3.tgz",
"integrity": "sha512-FyFMrXZv9CUacKRAoKoiQFrUHK43YAxTBTWR8DOdDA3fZpeVxSsxXoWJ9GES7Kjm+Wi+3A8s4gKlQXEWZNI+qQ==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"datatables.net-bs": "^1.10.15",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-rose": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-rose/-/legacy-plugin-chart-rose-0.15.1.tgz",
"integrity": "sha512-5vHyyCEJTXVLDeZcUgu81dI2gfelORKP4VupIDgqM8kreIMJJIR7DjJKJ4evaJhBaZKAkoqsIa2YfAGvdEosXg==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-rose/-/legacy-plugin-chart-rose-0.15.3.tgz",
"integrity": "sha512-Ho6kXNxk/OeDAHCQZvO956jqT+6qj5mznLdL+eYxFJQsn7JCOL8eyy9S+jV6CByPkkVavXdu1Lj1GkHOGfHsmw==",
"requires": {
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"nvd3": "1.8.6",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-sankey": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey/-/legacy-plugin-chart-sankey-0.15.1.tgz",
"integrity": "sha512-1OuEq9MVgGM7QRcS1p98mHXFqc6I/NZKX4yQtnz211LXxM/A4ufubzvBNdkYpaYjS4C36r27q7n/M2VXwYoVqw==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey/-/legacy-plugin-chart-sankey-0.15.3.tgz",
"integrity": "sha512-SBbxPj6KlPS87x3SB/MWaJl6n50+YHKAX4W9g+eZjPq5gDwGrlHyo1eZ7c1j+mqnShHgYQBSPnFwPCfDgG0hHw==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"d3-sankey": "^0.4.2",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-sankey-loop": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey-loop/-/legacy-plugin-chart-sankey-loop-0.15.1.tgz",
"integrity": "sha512-xGM6BuyFT8vmIDSvO4KWN5vi25q15v2LaOcUFkp7UyMHoWZ0vXwAgcJaLEpjWlESZmFoeWjYwRCGF2BoY6ukXg==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sankey-loop/-/legacy-plugin-chart-sankey-loop-0.15.3.tgz",
"integrity": "sha512-nCYszxV77W7EJXdC118J0QXOrMDt1TPhOxZpBa1a/WT7vPW/s4pmHfTzxqlkKQDBxMz2JiOnE9it5ZlK69vWhg==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3-sankey-diagram": "^0.7.3",
"d3-selection": "^1.4.0",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-sunburst": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sunburst/-/legacy-plugin-chart-sunburst-0.15.1.tgz",
"integrity": "sha512-+VB3Ga4R6/gdDcUAXQ8jAdZrhNFsdEJDa/oROPm8tjYJM/n7GZq0BUg1yesEJAjvysvQurZo7Nd/k/OaTDh8+Q==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-sunburst/-/legacy-plugin-chart-sunburst-0.15.3.tgz",
"integrity": "sha512-Vgcco4+zR5N5N0WQWSLVKlYqN62FS7sA4wd2zo1ZuNG8CtfhGa/NYmGg7e/LdT7o2pTdIYO9GvOzl+2XDr98sA==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-treemap": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-treemap/-/legacy-plugin-chart-treemap-0.15.1.tgz",
"integrity": "sha512-2rxJctQAPPo1OZkB3ZgX5iqME0eu2bNZCocuY13x+pw4yJCTsiQIvqE9PLEm36qKODrML9AiQCWlT+hV0YksiA==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-treemap/-/legacy-plugin-chart-treemap-0.15.3.tgz",
"integrity": "sha512-gbwShgoae78TbiXYApYQSCnwEec2aRSshEeKZWSW9KsLYFOkHXVspkqCkKdpQrhxQ3HeJM8T7yUnnI/dEGjp8g==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3-hierarchy": "^1.1.8",
"d3-selection": "^1.4.0",
"prop-types": "^15.6.2"
}
},
"@superset-ui/legacy-plugin-chart-world-map": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-world-map/-/legacy-plugin-chart-world-map-0.15.1.tgz",
"integrity": "sha512-UtuA5jO2ggoDglm4CiWyQEfB3DZoUvoDWZHR+MtpP/lRoEQdZCWd3/PPSHs1757SnNRNGLypL3vjV/3htvzW3g==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-world-map/-/legacy-plugin-chart-world-map-0.15.3.tgz",
"integrity": "sha512-qw+OSE4ywmIZio058Oy1KGuHvKVp4doj/cvSVhbTff4RMaFcxJdEFDmstUxniHFvljrf+Fvioriiw6EE50zRaQ==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"d3-array": "^2.4.0",
"d3-color": "^1.4.1",
@ -15646,13 +15642,13 @@
}
},
"@superset-ui/legacy-preset-chart-big-number": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-big-number/-/legacy-preset-chart-big-number-0.15.1.tgz",
"integrity": "sha512-ULgfY+Zco0SG59PWLirSAn1ocgS4DfalZWa9zlsn6rMRVBnWJ1G9xkEmVtFGjym3c4QUw2/EdFiSyZx2Ypnwzg==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-big-number/-/legacy-preset-chart-big-number-0.15.3.tgz",
"integrity": "sha512-BEnN6KT0wOYchvw7O5PWd6Xp8X/wee53yPyI3CkUJFWQqWq/2hlxSkMtH3oZT6fFZckt1f6dPPZd1M+l6wiOjQ==",
"requires": {
"@data-ui/xy-chart": "^0.0.84",
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"@types/d3-color": "^1.2.2",
"@types/shortid": "^0.0.29",
"d3-color": "^1.2.3",
@ -15685,13 +15681,13 @@
}
},
"@superset-ui/legacy-preset-chart-nvd3": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-nvd3/-/legacy-preset-chart-nvd3-0.15.1.tgz",
"integrity": "sha512-rzeYpJl+7r1wJRNlTbh8ZGOrJmL1k0JC09F52YCbCh0HRnZoK41PC7bZNFm/R2ahaMqBg7UagLOdIxCIYUUsuA==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-nvd3/-/legacy-preset-chart-nvd3-0.15.3.tgz",
"integrity": "sha512-FEq1gg9/byscCAkVL2F/809Mvh8xEgZtKCzg2Tzm1W3ESn0AmNgj8yq5N9fB3ghidvc0sSEaVjrkj74xKUMrHw==",
"requires": {
"@data-ui/xy-chart": "^0.0.84",
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"d3": "^3.5.17",
"d3-tip": "^0.9.1",
"dompurify": "^2.0.6",
@ -15705,24 +15701,24 @@
}
},
"@superset-ui/plugin-chart-echarts": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-echarts/-/plugin-chart-echarts-0.15.1.tgz",
"integrity": "sha512-fRFHfIwopNh8n7tfkCQtYt2bLUBvNgwHEPk0hWycl8Jn08lLc4lvfoWOhxGqv11UZC9klx9iPp78/5fhe4bVfg==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-echarts/-/plugin-chart-echarts-0.15.3.tgz",
"integrity": "sha512-kzELNmzIJr1KASYhuz1LkslFJ7XA16lid4DxlHlEGEw4Gmm8h0bl8KXnFeNbSpJHh95Qdfwrf2b7bmB6qmVKHg==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"@types/echarts": "^4.6.3",
"echarts": "^4.9.0"
}
},
"@superset-ui/plugin-chart-table": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-table/-/plugin-chart-table-0.15.1.tgz",
"integrity": "sha512-Xp8DasOjaLOcEZKPdp/sCmwfvu+QoINUOYRpi0Aln22OLrvv2aOfgOb9zVcqKM5yamYDkXxpkThgZ58IXBqkCA==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-table/-/plugin-chart-table-0.15.3.tgz",
"integrity": "sha512-Nl+pzZtZaQ/3dWdPEs6JiRbSiIHlMg8g2Q7rYyRhkHZXVF4QDBUcV/DugRxb5UPT9Ebt1SJJ4T6Eq9XPkgDvDg==",
"requires": {
"@emotion/core": "^10.0.28",
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"@types/d3-array": "^2.0.0",
"@types/match-sorter": "^4.0.0",
"@types/react-table": "^7.0.19",
@ -15743,12 +15739,12 @@
}
},
"@superset-ui/plugin-chart-word-cloud": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-word-cloud/-/plugin-chart-word-cloud-0.15.1.tgz",
"integrity": "sha512-oqBy/g8w5MonniFlns+SSfEjL/676ANber6n6MhgHX7tHi6VXTlSBRN1D/IzzZ0a0r0ockW/cP9unh4HvEB1Ng==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/plugin-chart-word-cloud/-/plugin-chart-word-cloud-0.15.3.tgz",
"integrity": "sha512-NXHnlUn6uDqILH+9RF3gyFHSxm+ljWx+5K4NoGdttMOoFKJuECkwSTlSz9mZAQUjMHHz96t+7H/2IovSJfMqZQ==",
"requires": {
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"@types/d3-cloud": "^1.2.1",
"@types/d3-scale": "^2.0.2",
"d3-cloud": "^1.2.5",
@ -15772,14 +15768,14 @@
}
},
"@superset-ui/preset-chart-xy": {
"version": "0.15.1",
"resolved": "https://registry.npmjs.org/@superset-ui/preset-chart-xy/-/preset-chart-xy-0.15.1.tgz",
"integrity": "sha512-tpKN6mjJIYaDfszLhvNnVOKhrk0duLSUsH+0FlkjCatoxEwfMCB2qONSmV/Pu6bsGZyA19S1g9kMj5tEblNKeQ==",
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/@superset-ui/preset-chart-xy/-/preset-chart-xy-0.15.3.tgz",
"integrity": "sha512-/Hp8Ew/Hwc9AGtqgPecU2FRXzRvCs/FjZZCHZORzw9zOul6y+fBqt/LWrbNSWUporP3vqw6LDd2t/G4cOcbayQ==",
"requires": {
"@data-ui/theme": "^0.0.84",
"@data-ui/xy-chart": "^0.0.84",
"@superset-ui/chart-controls": "0.15.1",
"@superset-ui/core": "0.15.1",
"@superset-ui/chart-controls": "0.15.3",
"@superset-ui/core": "0.15.2",
"@vx/axis": "^0.0.198",
"@vx/legend": "^0.0.198",
"@vx/scale": "^0.0.197",
@ -18889,6 +18885,16 @@
"normalize-path": "^2.1.1"
}
},
"aphrodite": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/aphrodite/-/aphrodite-1.2.5.tgz",
"integrity": "sha1-g1jDbIC7A67puXFlqqcBhiJbSYM=",
"requires": {
"asap": "^2.0.3",
"inline-style-prefixer": "^3.0.1",
"string-hash": "^1.1.3"
}
},
"app-root-dir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/app-root-dir/-/app-root-dir-1.0.2.tgz",
@ -23594,19 +23600,19 @@
}
},
"datatables.net": {
"version": "1.10.21",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.10.21.tgz",
"integrity": "sha512-/bSZtxmf3GTpYcvEmwZ8q26I1yhSx8qklR2B+s1K8+/51UW/zc2zTYwJMqr/Z+iCYixAc00ildj4g2x0Qamolw==",
"version": "1.10.22",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.10.22.tgz",
"integrity": "sha512-ujn8GvkQIBYzYH54XY7OrI0Zb35TKRd9ABYfbnXgBfwTGIFT6UsmXrfHU5Yk+MSDoF0sDu2TB+31V6c+zUZ0Pw==",
"requires": {
"jquery": ">=1.7"
}
},
"datatables.net-bs": {
"version": "1.10.21",
"resolved": "https://registry.npmjs.org/datatables.net-bs/-/datatables.net-bs-1.10.21.tgz",
"integrity": "sha512-4mpesFXNEkLlQET3IDLclLz95Xit4Kp/jHcOM2X0nc/ijDfO3qJk3ehZ+NSEAkXZDge6ZtY5Zxq2O90ISiIjwQ==",
"version": "1.10.22",
"resolved": "https://registry.npmjs.org/datatables.net-bs/-/datatables.net-bs-1.10.22.tgz",
"integrity": "sha512-sFEM/7vIMNsFjgYGpnTdIggZvVXzdPbVRRN98zp6jOf4VH7ei+MC3N39w6jnHiTDNu/2c3wRCMz077UpleXJOQ==",
"requires": {
"datatables.net": "1.10.21",
"datatables.net": "1.10.22",
"jquery": ">=1.7"
}
},
@ -24105,9 +24111,9 @@
}
},
"dompurify": {
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.15.tgz",
"integrity": "sha512-8AnYW8iXOC7xC7K3FBvQ7+GdmtOsgDGZC5dDXaewCC674qcId7G5mhz5VIEnVShJVjQdlcaPjxpaOzaV9JC3Tg=="
"version": "2.0.17",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.17.tgz",
"integrity": "sha512-nNwwJfW55r8akD8MSFz6k75bzyT2y6JEa1O3JrZFBf+Y5R9JXXU4OsRl0B9hKoPgHTw2b7ER5yJ5Md97MMUJPg=="
},
"domutils": {
"version": "1.5.1",
@ -28048,9 +28054,9 @@
"dev": true
},
"hyphenate-style-name": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz",
"integrity": "sha512-EcuixamT82oplpoJ2XU4pDtKGWQ7b00CD9f1ug9IaQ3p1bkHMiKCZ9ut9QDI6qsa6cpUuB+A/I+zLtdNK4n2DQ=="
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz",
"integrity": "sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ=="
},
"iconv-lite": {
"version": "0.4.24",
@ -33592,9 +33598,9 @@
}
},
"match-sorter": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/match-sorter/-/match-sorter-4.2.0.tgz",
"integrity": "sha512-oEvLn8R+a30YZ9l5XdCTkYQuLsOs8frxEqQTAuxoqkQx/qV5pQpx/NqAWvJ5xbYecqfXoF/ZevaIS1+NkbRymg==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/match-sorter/-/match-sorter-4.2.1.tgz",
"integrity": "sha512-s+3h9TiZU9U1pWhIERHf8/f4LmBN6IXaRgo2CI17+XGByGS1GvG5VvXK9pcGyCjGe3WM3mSYRC3ipGrd5UEVgw==",
"requires": {
"@babel/runtime": "^7.10.5",
"remove-accents": "0.4.2"

View File

@ -63,34 +63,34 @@
"@babel/runtime-corejs3": "^7.8.4",
"@data-ui/sparkline": "^0.0.54",
"@emotion/core": "^10.0.28",
"@superset-ui/chart-controls": "^0.15.1",
"@superset-ui/core": "^0.15.1",
"@superset-ui/legacy-plugin-chart-calendar": "^0.15.1",
"@superset-ui/legacy-plugin-chart-chord": "^0.15.1",
"@superset-ui/legacy-plugin-chart-country-map": "^0.15.1",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.15.1",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.15.1",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.15.1",
"@superset-ui/legacy-plugin-chart-histogram": "^0.15.1",
"@superset-ui/legacy-plugin-chart-horizon": "^0.15.1",
"@superset-ui/legacy-plugin-chart-map-box": "^0.15.1",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.15.1",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.15.1",
"@superset-ui/legacy-plugin-chart-partition": "^0.15.1",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.15.1",
"@superset-ui/legacy-plugin-chart-rose": "^0.15.1",
"@superset-ui/legacy-plugin-chart-sankey": "^0.15.1",
"@superset-ui/legacy-plugin-chart-sankey-loop": "^0.15.1",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.15.1",
"@superset-ui/legacy-plugin-chart-treemap": "^0.15.1",
"@superset-ui/legacy-plugin-chart-world-map": "^0.15.1",
"@superset-ui/legacy-preset-chart-big-number": "^0.15.1",
"@superset-ui/chart-controls": "^0.15.3",
"@superset-ui/core": "^0.15.2",
"@superset-ui/legacy-plugin-chart-calendar": "^0.15.3",
"@superset-ui/legacy-plugin-chart-chord": "^0.15.3",
"@superset-ui/legacy-plugin-chart-country-map": "^0.15.3",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.15.3",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.15.3",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.15.3",
"@superset-ui/legacy-plugin-chart-histogram": "^0.15.3",
"@superset-ui/legacy-plugin-chart-horizon": "^0.15.3",
"@superset-ui/legacy-plugin-chart-map-box": "^0.15.3",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.15.3",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.15.3",
"@superset-ui/legacy-plugin-chart-partition": "^0.15.3",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.15.3",
"@superset-ui/legacy-plugin-chart-rose": "^0.15.3",
"@superset-ui/legacy-plugin-chart-sankey": "^0.15.3",
"@superset-ui/legacy-plugin-chart-sankey-loop": "^0.15.3",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.15.3",
"@superset-ui/legacy-plugin-chart-treemap": "^0.15.3",
"@superset-ui/legacy-plugin-chart-world-map": "^0.15.3",
"@superset-ui/legacy-preset-chart-big-number": "^0.15.3",
"@superset-ui/legacy-preset-chart-deckgl": "^0.3.1",
"@superset-ui/legacy-preset-chart-nvd3": "^0.15.1",
"@superset-ui/plugin-chart-echarts": "^0.15.1",
"@superset-ui/plugin-chart-table": "^0.15.1",
"@superset-ui/plugin-chart-word-cloud": "^0.15.1",
"@superset-ui/preset-chart-xy": "^0.15.1",
"@superset-ui/legacy-preset-chart-nvd3": "^0.15.3",
"@superset-ui/plugin-chart-echarts": "^0.15.3",
"@superset-ui/plugin-chart-table": "^0.15.3",
"@superset-ui/plugin-chart-word-cloud": "^0.15.3",
"@superset-ui/preset-chart-xy": "^0.15.3",
"@vx/responsive": "^0.0.195",
"abortcontroller-polyfill": "^1.1.9",
"antd": "^4.5.2",

View File

@ -51,12 +51,14 @@ import {
DualLineChartPlugin,
LineChartPlugin,
LineMultiChartPlugin,
PieChartPlugin,
TimePivotChartPlugin,
} from '@superset-ui/legacy-preset-chart-nvd3';
import { LegacyBoxPlotChartPlugin } from '@superset-ui/preset-chart-xy';
import { DeckGLChartPreset } from '@superset-ui/legacy-preset-chart-deckgl';
import { EchartsTimeseriesChartPlugin } from '@superset-ui/plugin-chart-echarts';
import {
EchartsPieChartPlugin,
EchartsTimeseriesChartPlugin,
} from '@superset-ui/plugin-chart-echarts';
import FilterBoxChartPlugin from '../FilterBox/FilterBoxChartPlugin';
import TimeTableChartPlugin from '../TimeTable/TimeTableChartPlugin';
@ -92,7 +94,7 @@ export default class MainPreset extends Preset {
new PairedTTestChartPlugin().configure({ key: 'paired_ttest' }),
new ParallelCoordinatesChartPlugin().configure({ key: 'para' }),
new PartitionChartPlugin().configure({ key: 'partition' }),
new PieChartPlugin().configure({ key: 'pie' }),
new EchartsPieChartPlugin().configure({ key: 'pie' }),
new PivotTableChartPlugin().configure({ key: 'pivot_table' }),
new RoseChartPlugin().configure({ key: 'rose' }),
new SankeyChartPlugin().configure({ key: 'sankey' }),

View File

@ -1644,57 +1644,6 @@ class NVD3TimeSeriesStackedViz(NVD3TimeSeriesViz):
pivot_fill_value = 0
class DistributionPieViz(NVD3Viz):
"""Annoy visualization snobs with this controversial pie chart"""
viz_type = "pie"
verbose_name = _("Distribution - NVD3 - Pie Chart")
is_timeseries = False
def get_data(self, df: pd.DataFrame) -> VizData:
def _label_aggfunc(labels: pd.Series) -> str:
"""
Convert a single or multi column label into a single label, replacing
null values with `NULL_STRING` and joining multiple columns together
with a comma. Examples:
>>> _label_aggfunc(pd.Series(["abc"]))
'abc'
>>> _label_aggfunc(pd.Series([1]))
'1'
>>> _label_aggfunc(pd.Series(["abc", "def"]))
'abc, def'
>>> # note: integer floats are stripped of decimal digits
>>> _label_aggfunc(pd.Series([0.1, 2.0, 0.3]))
'0.1, 2, 0.3'
>>> _label_aggfunc(pd.Series([1, None, "abc", 0.8], dtype="object"))
'1, <NULL>, abc, 0.8'
"""
label_list: List[str] = []
for label in labels:
if isinstance(label, str):
label_recast = label
elif label is None or isinstance(label, float) and math.isnan(label):
label_recast = NULL_STRING
elif isinstance(label, float) and label.is_integer():
label_recast = str(int(label))
else:
label_recast = str(label)
label_list.append(label_recast)
return ", ".join(label_list)
if df.empty:
return None
metric = self.metric_labels[0]
df = pd.DataFrame(
{"x": df[self.groupby].agg(func=_label_aggfunc, axis=1), "y": df[metric]}
)
df.sort_values(by="y", ascending=False, inplace=True)
return df.to_dict(orient="records")
class HistogramViz(BaseViz):
"""Histogram"""
@ -1751,7 +1700,7 @@ class HistogramViz(BaseViz):
return chart_data
class DistributionBarViz(DistributionPieViz):
class DistributionBarViz(BaseViz):
"""A good old bar chart"""

View File

@ -1384,60 +1384,3 @@ class TestPivotTableViz(SupersetTestCase):
def test_format_datetime_from_int(self):
assert viz.PivotTableViz._format_datetime(123) == 123
assert viz.PivotTableViz._format_datetime(123.0) == 123.0
class TestDistributionPieViz(SupersetTestCase):
base_df = pd.DataFrame(
data={
"intcol": [1, 2, 3, 4, None],
"floatcol": [1.0, 0.2, 0.3, 0.4, None],
"strcol_a": ["a", "a", "a", "a", None],
"strcol": ["a", "b", "c", None, "d"],
}
)
@staticmethod
def get_cols(data: List[Dict[str, Any]]) -> Set[str]:
return set([row["x"] for row in data])
def test_bool_groupby(self):
datasource = self.get_datasource_mock()
df = pd.DataFrame(data={"intcol": [1, 2, None], "boolcol": [True, None, False]})
pie_viz = viz.DistributionPieViz(
datasource, {"metrics": ["intcol"], "groupby": ["boolcol"]},
)
data = pie_viz.get_data(df)
assert self.get_cols(data) == {"True", "False", "<NULL>"}
def test_string_groupby(self):
datasource = self.get_datasource_mock()
pie_viz = viz.DistributionPieViz(
datasource, {"metrics": ["floatcol"], "groupby": ["strcol"]},
)
data = pie_viz.get_data(self.base_df)
assert self.get_cols(data) == {"<NULL>", "a", "b", "c", "d"}
def test_int_groupby(self):
datasource = self.get_datasource_mock()
pie_viz = viz.DistributionPieViz(
datasource, {"metrics": ["floatcol"], "groupby": ["intcol"]},
)
data = pie_viz.get_data(self.base_df)
assert self.get_cols(data) == {"<NULL>", "1", "2", "3", "4"}
def test_float_groupby(self):
datasource = self.get_datasource_mock()
pie_viz = viz.DistributionPieViz(
datasource, {"metrics": ["intcol"], "groupby": ["floatcol"]},
)
data = pie_viz.get_data(self.base_df)
assert self.get_cols(data) == {"<NULL>", "1", "0.2", "0.3", "0.4"}
def test_multi_groupby(self):
datasource = self.get_datasource_mock()
pie_viz = viz.DistributionPieViz(
datasource, {"metrics": ["floatcol"], "groupby": ["intcol", "strcol"]},
)
data = pie_viz.get_data(self.base_df)
assert self.get_cols(data) == {"1, a", "2, b", "3, c", "4, <NULL>", "<NULL>, d"}