From 30a4e22140345936200fbff5cb1d02194c054fc0 Mon Sep 17 00:00:00 2001 From: Erik Ritter Date: Mon, 10 Jun 2019 15:12:51 -0700 Subject: [PATCH] fix: ignore disabled series in stacked bar values (#116) --- .../plugins/superset-ui-plugins/package.json | 2 +- .../src/NVD3Vis.js | 4 +- .../src/utils.js | 2 +- .../legacy-preset-chart-nvd3/Bar/data.js | 900 ------------------ .../src/encodeable/AbstractEncoder.ts | 2 +- .../src/encodeable/types/Data.ts | 2 +- 6 files changed, 5 insertions(+), 907 deletions(-) diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/package.json b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/package.json index 9b3829106389a..c0b4c1903694d 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/package.json +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/package.json @@ -39,7 +39,7 @@ ], "license": "Apache-2.0", "devDependencies": { - "@superset-ui/build-config": "^0.0.9", + "@superset-ui/build-config": "^0.0.11", "@superset-ui/commit-config": "^0.0.9", "@superset-ui/chart": "^0.11.8", "@superset-ui/chart-composition": "^0.11.9", diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js index de9ee0c504644..4f78da8e7c393 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js @@ -769,9 +769,7 @@ function nvd3Vis(element, props) { key, color: a.color, strokeWidth: a.width, - classed: `${a.opacity} ${a.style} nv-timeseries-annotation-layer showMarkers${ - a.showMarkers - } hideLine${a.hideLine}`, + classed: `${a.opacity} ${a.style} nv-timeseries-annotation-layer showMarkers${a.showMarkers} hideLine${a.hideLine}`, }; }), ), diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/utils.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/utils.js index 9225a561fdf4b..d4a6fe2db292c 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/utils.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/utils.js @@ -55,7 +55,7 @@ export function drawBarValues(svg, data, stacked, axisFormat) { const totalStackedValues = stacked && data.length !== 0 ? data[0].values.map((bar, iBar) => { - const bars = data.map(series => series.values[iBar]); + const bars = data.filter(series => !series.disabled).map(series => series.values[iBar]); return d3.sum(bars, d => d.y); }) diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-nvd3/Bar/data.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-nvd3/Bar/data.js index 99c2b4459a76f..4e7ac2788c0c8 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-nvd3/Bar/data.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-nvd3/Bar/data.js @@ -43,186 +43,6 @@ export default [ x: -31536000000.0, y: 1242569208.0, }, - { - x: 0.0, - y: 1274888198.0, - }, - { - x: 31536000000.0, - y: 1308215425.0, - }, - { - x: 63072000000.0, - y: 1339781984.0, - }, - { - x: 94694400000.0, - y: 1369814002.0, - }, - { - x: 126230400000.0, - y: 1399636343.0, - }, - { - x: 157766400000.0, - y: 1426562368.0, - }, - { - x: 189302400000.0, - y: 1450503110.0, - }, - { - x: 220924800000.0, - y: 1473091499.0, - }, - { - x: 252460800000.0, - y: 1495573053.0, - }, - { - x: 283996800000.0, - y: 1518439245.0, - }, - { - x: 315532800000.0, - y: 1540823440.0, - }, - { - x: 347155200000.0, - y: 1563926423.0, - }, - { - x: 378691200000.0, - y: 1589245249.0, - }, - { - x: 410227200000.0, - y: 1614538807.0, - }, - { - x: 441763200000.0, - y: 1638618355.0, - }, - { - x: 473385600000.0, - y: 1663385538.0, - }, - { - x: 504921600000.0, - y: 1689894237.0, - }, - { - x: 536457600000.0, - y: 1717904169.0, - }, - { - x: 567993600000.0, - y: 1746140324.0, - }, - { - x: 599616000000.0, - y: 1773743982.0, - }, - { - x: 631152000000.0, - y: 1800365903.0, - }, - { - x: 662688000000.0, - y: 1825955698.0, - }, - { - x: 694224000000.0, - y: 1849800435.0, - }, - { - x: 725846400000.0, - y: 1872809684.0, - }, - { - x: 757382400000.0, - y: 1895892806.0, - }, - { - x: 788918400000.0, - y: 1918680993.0, - }, - { - x: 820454400000.0, - y: 1941199188.0, - }, - { - x: 852076800000.0, - y: 1963227851.0, - }, - { - x: 883612800000.0, - y: 1984508261.0, - }, - { - x: 915148800000.0, - y: 2004495631.0, - }, - { - x: 946684800000.0, - y: 2023534787.0, - }, - { - x: 978307200000.0, - y: 2041915058.0, - }, - { - x: 1009843200000.0, - y: 2059375225.0, - }, - { - x: 1041379200000.0, - y: 2076029083.0, - }, - { - x: 1072915200000.0, - y: 2092086887.0, - }, - { - x: 1104537600000.0, - y: 2107802765.0, - }, - { - x: 1136073600000.0, - y: 2123180222.0, - }, - { - x: 1167609600000.0, - y: 2137834848.0, - }, - { - x: 1199145600000.0, - y: 2152663168.0, - }, - { - x: 1230768000000.0, - y: 2167098541.0, - }, - { - x: 1262304000000.0, - y: 2181465325.0, - }, - { - x: 1293840000000.0, - y: 2195899073.0, - }, - { - x: 1325376000000.0, - y: 2210627396.0, - }, - { - x: 1356998400000.0, - y: 2225523116.0, - }, - { - x: 1388534400000.0, - y: 2240687901.0, - }, ], }, { @@ -268,186 +88,6 @@ export default [ x: -31536000000.0, y: 697060567.0, }, - { - x: 0.0, - y: 713115397.0, - }, - { - x: 31536000000.0, - y: 729469562.0, - }, - { - x: 63072000000.0, - y: 746222138.0, - }, - { - x: 94694400000.0, - y: 763491289.0, - }, - { - x: 126230400000.0, - y: 781254784.0, - }, - { - x: 157766400000.0, - y: 799620311.0, - }, - { - x: 189302400000.0, - y: 818590962.0, - }, - { - x: 220924800000.0, - y: 838141522.0, - }, - { - x: 252460800000.0, - y: 858266916.0, - }, - { - x: 283996800000.0, - y: 878939779.0, - }, - { - x: 315532800000.0, - y: 900085240.0, - }, - { - x: 347155200000.0, - y: 921521635.0, - }, - { - x: 378691200000.0, - y: 943662470.0, - }, - { - x: 410227200000.0, - y: 966101576.0, - }, - { - x: 441763200000.0, - y: 988898603.0, - }, - { - x: 473385600000.0, - y: 1012110768.0, - }, - { - x: 504921600000.0, - y: 1035703508.0, - }, - { - x: 536457600000.0, - y: 1059570231.0, - }, - { - x: 567993600000.0, - y: 1083711645.0, - }, - { - x: 599616000000.0, - y: 1108132042.0, - }, - { - x: 631152000000.0, - y: 1132775493.0, - }, - { - x: 662688000000.0, - y: 1157716007.0, - }, - { - x: 694224000000.0, - y: 1182766320.0, - }, - { - x: 725846400000.0, - y: 1208041749.0, - }, - { - x: 757382400000.0, - y: 1233462879.0, - }, - { - x: 788918400000.0, - y: 1258964893.0, - }, - { - x: 820454400000.0, - y: 1284467586.0, - }, - { - x: 852076800000.0, - y: 1310020410.0, - }, - { - x: 883612800000.0, - y: 1335551944.0, - }, - { - x: 915148800000.0, - y: 1361114276.0, - }, - { - x: 946684800000.0, - y: 1386400954.0, - }, - { - x: 978307200000.0, - y: 1411281514.0, - }, - { - x: 1009843200000.0, - y: 1436503016.0, - }, - { - x: 1041379200000.0, - y: 1461682019.0, - }, - { - x: 1072915200000.0, - y: 1486598228.0, - }, - { - x: 1104537600000.0, - y: 1511119581.0, - }, - { - x: 1136073600000.0, - y: 1535264779.0, - }, - { - x: 1167609600000.0, - y: 1559023139.0, - }, - { - x: 1199145600000.0, - y: 1582535507.0, - }, - { - x: 1230768000000.0, - y: 1605893501.0, - }, - { - x: 1262304000000.0, - y: 1629189137.0, - }, - { - x: 1293840000000.0, - y: 1652449539.0, - }, - { - x: 1325376000000.0, - y: 1674883124.0, - }, - { - x: 1356998400000.0, - y: 1697955143.0, - }, - { - x: 1388534400000.0, - y: 1720976995.0, - }, ], }, { @@ -493,186 +133,6 @@ export default [ x: -31536000000.0, y: 725099571.0, }, - { - x: 0.0, - y: 730528170.0, - }, - { - x: 31536000000.0, - y: 736135494.0, - }, - { - x: 63072000000.0, - y: 742450677.0, - }, - { - x: 94694400000.0, - y: 748475832.0, - }, - { - x: 126230400000.0, - y: 754297089.0, - }, - { - x: 157766400000.0, - y: 759928297.0, - }, - { - x: 189302400000.0, - y: 765417984.0, - }, - { - x: 220924800000.0, - y: 770663924.0, - }, - { - x: 252460800000.0, - y: 775939424.0, - }, - { - x: 283996800000.0, - y: 781099684.0, - }, - { - x: 315532800000.0, - y: 786407417.0, - }, - { - x: 347155200000.0, - y: 791686169.0, - }, - { - x: 378691200000.0, - y: 796410256.0, - }, - { - x: 410227200000.0, - y: 800966617.0, - }, - { - x: 441763200000.0, - y: 805742116.0, - }, - { - x: 473385600000.0, - y: 810633713.0, - }, - { - x: 504921600000.0, - y: 815649358.0, - }, - { - x: 536457600000.0, - y: 820716895.0, - }, - { - x: 567993600000.0, - y: 825834599.0, - }, - { - x: 599616000000.0, - y: 830998751.0, - }, - { - x: 631152000000.0, - y: 842907397.0, - }, - { - x: 662688000000.0, - y: 846199873.0, - }, - { - x: 694224000000.0, - y: 849633122.0, - }, - { - x: 725846400000.0, - y: 852664422.0, - }, - { - x: 757382400000.0, - y: 854549337.0, - }, - { - x: 788918400000.0, - y: 856102195.0, - }, - { - x: 820454400000.0, - y: 857333424.0, - }, - { - x: 852076800000.0, - y: 858726155.0, - }, - { - x: 883612800000.0, - y: 859806214.0, - }, - { - x: 915148800000.0, - y: 860985079.0, - }, - { - x: 946684800000.0, - y: 862073997.0, - }, - { - x: 978307200000.0, - y: 863554388.0, - }, - { - x: 1009843200000.0, - y: 865246750.0, - }, - { - x: 1041379200000.0, - y: 867562844.0, - }, - { - x: 1072915200000.0, - y: 870213016.0, - }, - { - x: 1104537600000.0, - y: 872968147.0, - }, - { - x: 1136073600000.0, - y: 875755753.0, - }, - { - x: 1167609600000.0, - y: 878819656.0, - }, - { - x: 1199145600000.0, - y: 882358214.0, - }, - { - x: 1230768000000.0, - y: 886063249.0, - }, - { - x: 1262304000000.0, - y: 889630390.0, - }, - { - x: 1293840000000.0, - y: 893094109.0, - }, - { - x: 1325376000000.0, - y: 894962840.0, - }, - { - x: 1356998400000.0, - y: 898837065.0, - }, - { - x: 1388534400000.0, - y: 903095786.0, - }, ], }, { @@ -718,186 +178,6 @@ export default [ x: -31536000000.0, y: 284502453.0, }, - { - x: 0.0, - y: 291897883.0, - }, - { - x: 31536000000.0, - y: 299578724.0, - }, - { - x: 63072000000.0, - y: 307524082.0, - }, - { - x: 94694400000.0, - y: 315758889.0, - }, - { - x: 126230400000.0, - y: 324316627.0, - }, - { - x: 157766400000.0, - y: 333222446.0, - }, - { - x: 189302400000.0, - y: 342489556.0, - }, - { - x: 220924800000.0, - y: 352109622.0, - }, - { - x: 252460800000.0, - y: 362076216.0, - }, - { - x: 283996800000.0, - y: 372390972.0, - }, - { - x: 315532800000.0, - y: 383043891.0, - }, - { - x: 347155200000.0, - y: 394021126.0, - }, - { - x: 378691200000.0, - y: 405328909.0, - }, - { - x: 410227200000.0, - y: 416982682.0, - }, - { - x: 441763200000.0, - y: 429008541.0, - }, - { - x: 473385600000.0, - y: 441414277.0, - }, - { - x: 504921600000.0, - y: 454197298.0, - }, - { - x: 536457600000.0, - y: 467337821.0, - }, - { - x: 567993600000.0, - y: 480809661.0, - }, - { - x: 599616000000.0, - y: 494580339.0, - }, - { - x: 631152000000.0, - y: 508616039.0, - }, - { - x: 662688000000.0, - y: 523007873.0, - }, - { - x: 694224000000.0, - y: 537759561.0, - }, - { - x: 725846400000.0, - y: 552842678.0, - }, - { - x: 757382400000.0, - y: 568228356.0, - }, - { - x: 788918400000.0, - y: 583892679.0, - }, - { - x: 820454400000.0, - y: 599858645.0, - }, - { - x: 852076800000.0, - y: 616161312.0, - }, - { - x: 883612800000.0, - y: 632857149.0, - }, - { - x: 915148800000.0, - y: 650030484.0, - }, - { - x: 946684800000.0, - y: 667742098.0, - }, - { - x: 978307200000.0, - y: 685795280.0, - }, - { - x: 1009843200000.0, - y: 704102354.0, - }, - { - x: 1041379200000.0, - y: 722925207.0, - }, - { - x: 1072915200000.0, - y: 742396040.0, - }, - { - x: 1104537600000.0, - y: 762555740.0, - }, - { - x: 1136073600000.0, - y: 783427658.0, - }, - { - x: 1167609600000.0, - y: 805010175.0, - }, - { - x: 1199145600000.0, - y: 827287676.0, - }, - { - x: 1230768000000.0, - y: 850225069.0, - }, - { - x: 1262304000000.0, - y: 873800152.0, - }, - { - x: 1293840000000.0, - y: 898002051.0, - }, - { - x: 1325376000000.0, - y: 922840423.0, - }, - { - x: 1356998400000.0, - y: 948287652.0, - }, - { - x: 1388534400000.0, - y: 974315323.0, - }, ], }, { @@ -943,186 +223,6 @@ export default [ x: -31536000000.0, y: 280641049.0, }, - { - x: 0.0, - y: 287763515.0, - }, - { - x: 31536000000.0, - y: 295026304.0, - }, - { - x: 63072000000.0, - y: 302408883.0, - }, - { - x: 94694400000.0, - y: 309902169.0, - }, - { - x: 126230400000.0, - y: 317479496.0, - }, - { - x: 157766400000.0, - y: 325120067.0, - }, - { - x: 189302400000.0, - y: 332817916.0, - }, - { - x: 220924800000.0, - y: 340569396.0, - }, - { - x: 252460800000.0, - y: 348391181.0, - }, - { - x: 283996800000.0, - y: 356288443.0, - }, - { - x: 315532800000.0, - y: 364270961.0, - }, - { - x: 347155200000.0, - y: 372330102.0, - }, - { - x: 378691200000.0, - y: 380466998.0, - }, - { - x: 410227200000.0, - y: 388654061.0, - }, - { - x: 441763200000.0, - y: 396869481.0, - }, - { - x: 473385600000.0, - y: 405083115.0, - }, - { - x: 504921600000.0, - y: 413292690.0, - }, - { - x: 536457600000.0, - y: 421490233.0, - }, - { - x: 567993600000.0, - y: 429668211.0, - }, - { - x: 599616000000.0, - y: 437843614.0, - }, - { - x: 631152000000.0, - y: 445998222.0, - }, - { - x: 662688000000.0, - y: 454117634.0, - }, - { - x: 694224000000.0, - y: 462201058.0, - }, - { - x: 725846400000.0, - y: 470263697.0, - }, - { - x: 757382400000.0, - y: 478310786.0, - }, - { - x: 788918400000.0, - y: 486343677.0, - }, - { - x: 820454400000.0, - y: 494384205.0, - }, - { - x: 852076800000.0, - y: 502390020.0, - }, - { - x: 883612800000.0, - y: 510356845.0, - }, - { - x: 915148800000.0, - y: 518188225.0, - }, - { - x: 946684800000.0, - y: 525886558.0, - }, - { - x: 978307200000.0, - y: 533449671.0, - }, - { - x: 1009843200000.0, - y: 540884684.0, - }, - { - x: 1041379200000.0, - y: 548225528.0, - }, - { - x: 1072915200000.0, - y: 555515431.0, - }, - { - x: 1104537600000.0, - y: 562783235.0, - }, - { - x: 1136073600000.0, - y: 570029991.0, - }, - { - x: 1167609600000.0, - y: 577248307.0, - }, - { - x: 1199145600000.0, - y: 584435842.0, - }, - { - x: 1230768000000.0, - y: 591577623.0, - }, - { - x: 1262304000000.0, - y: 598662941.0, - }, - { - x: 1293840000000.0, - y: 605674766.0, - }, - { - x: 1325376000000.0, - y: 612617659.0, - }, - { - x: 1356998400000.0, - y: 619487273.0, - }, - { - x: 1388534400000.0, - y: 626270167.0, - }, ], }, ]; diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/AbstractEncoder.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/AbstractEncoder.ts index 52208269608b6..201fca1cdcaee 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/AbstractEncoder.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/AbstractEncoder.ts @@ -10,7 +10,7 @@ import ChannelEncoder from './ChannelEncoder'; type AllChannelEncoders>> = { readonly [k in keyof Encoding]: Encoding[k] extends any[] ? ChannelEncoder>[] - : ChannelEncoder> + : ChannelEncoder>; }; export default abstract class AbstractEncoder< diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/types/Data.ts b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/types/Data.ts index 9b09e14702a1f..0ce806c49dafa 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/types/Data.ts +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-preset-chart-xy/src/encodeable/types/Data.ts @@ -1,5 +1,5 @@ export type PlainObject = { - [key in Key]: Value + [key in Key]: Value; }; export type Dataset = Partial>[];