From 4c335a1df9fd8b8a69b70234c8a7a1665ab281b1 Mon Sep 17 00:00:00 2001 From: Krist Wongsuphasawat Date: Wed, 18 Sep 2019 22:43:17 -0700 Subject: [PATCH] docs: add polygon demo --- .../Polygon/Stories.tsx | 74 ++++ .../Polygon/index.js | 8 + .../Polygon/payload.js | 362 ++++++++++++++++++ 3 files changed, 444 insertions(+) create mode 100644 superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/Stories.tsx create mode 100644 superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/index.js create mode 100644 superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/payload.js diff --git a/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/Stories.tsx b/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/Stories.tsx new file mode 100644 index 0000000000..59cac28b6e --- /dev/null +++ b/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/Stories.tsx @@ -0,0 +1,74 @@ +/* eslint-disable no-magic-numbers */ +import React from 'react'; +import { SuperChart } from '@superset-ui/chart'; +import payload from './payload'; +import dummyDatasource from '../../../shared/dummyDatasource'; + +export default [ + { + renderStory: () => ( + + ), + storyName: 'Basic', + storyPath: 'legacy-|preset-chart-deckgl|PolygonChartPlugin', + }, +]; diff --git a/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/index.js b/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/index.js new file mode 100644 index 0000000000..af3ed8df58 --- /dev/null +++ b/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/index.js @@ -0,0 +1,8 @@ +import { PolygonChartPlugin } from '../../../../../superset-ui-legacy-preset-chart-deckgl/src'; +import Stories from './Stories'; + +new PolygonChartPlugin().configure({ key: 'deck_polygon' }).register(); + +export default { + examples: [...Stories], +}; diff --git a/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/payload.js b/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/payload.js new file mode 100644 index 0000000000..76dd392a85 --- /dev/null +++ b/superset-frontend/temporary_superset_ui/superset-ui-plugins-deckgl/packages/superset-ui-plugins-demo/storybook/stories/legacy-preset-chart-deckgl/Polygon/payload.js @@ -0,0 +1,362 @@ +export default { + cache_key: null, + cached_dttm: null, + cache_timeout: 86400, + error: null, + form_data: { + datasource: '9__table', + viz_type: 'deck_polygon', + slice_id: 70, + url_params: {}, + granularity_sqla: null, + time_grain_sqla: null, + time_range: ' : ', + line_column: 'contour', + line_type: 'json', + adhoc_filters: [ + { + clause: 'WHERE', + expressionType: 'SIMPLE', + filterOptionName: '8039e26e-6daa-4daa-87ae-a9932e3500e6', + comparator: '', + operator: 'IS NOT NULL', + subject: 'contour', + }, + ], + metric: 'count', + point_radius_fixed: { type: 'fix', value: 1000 }, + row_limit: 10000, + reverse_long_lat: false, + filter_nulls: true, + mapbox_style: 'mapbox://styles/mapbox/light-v9', + viewport: { + altitude: 1.5, + bearing: 37.89506450385642, + height: 906, + latitude: 37.752020331384834, + longitude: -122.43388541747726, + maxLatitude: 85.05113, + maxPitch: 60, + maxZoom: 20, + minLatitude: -85.05113, + minPitch: 0, + minZoom: 0, + pitch: 60, + width: 667, + zoom: 11.133995608594631, + }, + autozoom: true, + fill_color_picker: { a: 1, b: 73, g: 65, r: 3 }, + stroke_color_picker: { a: 1, b: 135, g: 122, r: 0 }, + filled: true, + stroked: false, + extruded: true, + multiplier: 1, + line_width: 10, + linear_color_scheme: 'blue_white_yellow', + opacity: 80, + num_buckets: 5, + table_filter: false, + toggle_polygons: true, + legend_position: 'tr', + legend_format: null, + js_columns: ['population', 'area'], + where: '', + having: '', + having_filters: [], + filters: [{ col: 'contour', op: 'IS NOT NULL', val: '' }], + }, + is_cached: false, + query: + 'SELECT population AS population,\n area AS area,\n contour AS contour,\n COUNT(*) AS count\nFROM sf_population_polygons\nWHERE contour IS NOT NULL\nGROUP BY population,\n area,\n contour\nORDER BY count DESC\nLIMIT 10000\nOFFSET 0', + status: 'success', + stacktrace: null, + rowcount: 25, + data: { + features: [ + { + population: 406, + area: 0.18, + count: 1, + polygon: [ + [-122.4000672, 37.7903039], + [-122.4020657, 37.7887212], + [-122.4019604, 37.7889222], + [-122.4021896, 37.7900391], + [-122.4038416, 37.7898293], + [-122.4046134, 37.7935651], + [-122.4001488, 37.7941342], + [-122.399572, 37.7913265], + [-122.3994942, 37.7913249], + [-122.3991486, 37.7910166], + [-122.39948, 37.7907443], + [-122.4000672, 37.7903039], + ], + __timestamp: null, + elevation: 1000, + extraProps: { population: 406, area: 0.18 }, + }, + { + population: 3183, + area: 6.11, + count: 1, + polygon: [ + [-122.4709907, 37.7875345], + [-122.4725434, 37.787369], + [-122.474584, 37.7870491], + [-122.4761622, 37.7869787], + [-122.478708, 37.7869141], + [-122.4813756, 37.7871989], + [-122.4839107, 37.7877057], + [-122.4840196, 37.7886714], + [-122.4840713, 37.7895716], + [-122.484215, 37.7897676], + [-122.4862218, 37.7905133], + [-122.4861481, 37.7906058], + [-122.4861088, 37.7906875], + [-122.4858962, 37.7908937], + [-122.4857404, 37.7910213], + [-122.4854114, 37.7914684], + [-122.4852847, 37.791713], + [-122.484995, 37.7919486], + [-122.4847529, 37.7922157], + [-122.4845413, 37.7925221], + [-122.4843636, 37.7927401], + [-122.4840721, 37.793295], + [-122.4838582, 37.7936461], + [-122.4835934, 37.7940352], + [-122.4832937, 37.7946713], + [-122.4835185, 37.79473], + [-122.4830886, 37.7956115], + [-122.4829995, 37.7959034], + [-122.4811062, 37.7996127], + [-122.4810689, 37.7997047], + [-122.4810634, 37.7998236], + [-122.4809868, 37.7999382], + [-122.4809748, 37.8003312], + [-122.480758, 37.8004434], + [-122.4806561, 37.8006483], + [-122.4805924, 37.800725], + [-122.4803755, 37.8010946], + [-122.480296, 37.8012937], + [-122.4802023, 37.8014169], + [-122.4801818, 37.8015573], + [-122.4488026, 37.801772], + [-122.4483597, 37.8015868], + [-122.4479216, 37.8015323], + [-122.4478196, 37.8016332], + [-122.4473414, 37.7985527], + [-122.447303, 37.798459199999996], + [-122.4462995, 37.7918785], + [-122.4493673, 37.791488], + [-122.4509955, 37.7912099], + [-122.4520356, 37.7909989], + [-122.4590286, 37.789716], + [-122.4594757, 37.7897106], + [-122.4599255, 37.7895428], + [-122.4686535, 37.7877835], + [-122.4709907, 37.7875345], + ], + __timestamp: null, + elevation: 1000, + extraProps: { population: 3183, area: 6.11 }, + }, + { + population: 3713, + area: 0.9, + count: 1, + polygon: [ + [-122.4000583, 37.7936936], + [-122.4001488, 37.7941342], + [-122.4046134, 37.7935651], + [-122.405143, 37.796211], + [-122.4018534, 37.7966262], + [-122.4022286, 37.7984297], + [-122.4031596, 37.8030984], + [-122.4047983, 37.8029008], + [-122.4055454, 37.8066342], + [-122.4054957, 37.8066406], + [-122.4046961, 37.8062647], + [-122.4031944, 37.8051186], + [-122.4017323, 37.8051922], + [-122.400573, 37.806121], + [-122.4009636, 37.8035634], + [-122.4008425, 37.8034294], + [-122.4004799, 37.8034661], + [-122.3985512, 37.8046028], + [-122.3985201, 37.8046033], + [-122.3985596, 37.8045264], + [-122.3982279, 37.8042811], + [-122.3982256, 37.8042564], + [-122.3999717, 37.803225], + [-122.3996027, 37.8028079], + [-122.3978247, 37.8038103], + [-122.3977935, 37.8038108], + [-122.3975172, 37.8034946], + [-122.3975148, 37.8034706], + [-122.3996153, 37.8022824], + [-122.3997233, 37.8021763], + [-122.3994097, 37.8018242], + [-122.3992151, 37.8018645], + [-122.3971156, 37.803021], + [-122.3970844, 37.8030215], + ], + __timestamp: null, + elevation: 1000, + extraProps: { population: 5846, area: 1.23 }, + }, + { + population: 13768, + area: 0.75, + count: 1, + polygon: [ + [-122.4042198, 37.7916906], + [-122.4038416, 37.7898293], + [-122.4021896, 37.7900391], + [-122.4019604, 37.7889222], + [-122.4020657, 37.7887212], + [-122.4029031, 37.7880856], + [-122.4034308, 37.7876418], + [-122.4045833, 37.7867306], + [-122.4048499, 37.78681], + [-122.4080362, 37.7864096], + [-122.408595, 37.7892256], + [-122.4118857, 37.7888075], + [-122.4122662, 37.7906728], + [-122.4139159, 37.7904631], + [-122.4148256, 37.7949882], + [-122.405143, 37.796211], + [-122.4049572, 37.7953267], + [-122.4047106, 37.7940214], + [-122.4042198, 37.7916906], + ], + __timestamp: null, + elevation: 1000, + extraProps: { population: 13768, area: 0.75 }, + }, + { + population: 19289, + area: 4.4, + count: 1, + polygon: [ + [-122.4586889, 37.7307515], + [-122.4591931, 37.730603], + [-122.4593522, 37.7305158], + [-122.4595637, 37.7303686], + [-122.4597838, 37.7301095], + [-122.4598784, 37.7298845], + [-122.4599838, 37.7295225], + [-122.460024, 37.7291957], + [-122.4600025, 37.7287394], + [-122.4604127, 37.7287392], + [-122.4608163, 37.7286811], + [-122.4614222, 37.7283303], + [-122.4618248, 37.7281189], + [-122.4620685, 37.7280496], + [-122.4623783, 37.7280113], + [-122.4627034, 37.7280243], + [-122.4628883, 37.728055499999996], + [-122.4627359, 37.7277841], + [-122.4626158, 37.7275292], + [-122.4625471, 37.7272254], + [-122.4625456, 37.7269975], + [-122.4626867, 37.7257749], + [-122.4628155, 37.7254824], + [-122.4622126, 37.7252655], + [-122.4622803, 37.7251473], + [-122.4622712, 37.7230211], + [-122.4624314, 37.723008899999996], + [-122.462655, 37.7229479], + [-122.4628403, 37.7228017], + [-122.463189, 37.7226046], + [-122.4637514, 37.7223952], + [-122.4639816, 37.722327], + [-122.4642937, 37.7221137], + [-122.4644348, 37.7219078], + [-122.4644842, 37.72168], + [-122.4716737, 37.7216313], + [-122.4717603, 37.7216712], + [-122.4723224, 37.7216238], + [-122.4720569, 37.726824], + [-122.4719072, 37.7289272], + [-122.4715943, 37.7289021], + [-122.4715487, 37.729784], + [-122.4718665, 37.7297845], + [-122.4715693, 37.7347068], + [-122.4710681, 37.7356067], + [-122.4705741, 37.736589], + [-122.47068, 37.736647], + [-122.4708059, 37.7367737], + [-122.4708698, 37.7369516], + [-122.4442995, 37.7322772], + [-122.4442889, 37.7315689], + [-122.4465784, 37.731549], + [-122.4534113, 37.7315306], + [-122.4535909, 37.7314884], + [-122.4549159, 37.731465], + [-122.4557626, 37.7313488], + [-122.4566075, 37.7311877], + [-122.4574742, 37.7309975], + [-122.4582225, 37.7307774], + [-122.4584725, 37.7307528], + [-122.4586889, 37.7307515], + ], + __timestamp: null, + elevation: 1000, + extraProps: { population: 19289, area: 4.4 }, + }, + { + population: 23088, + area: 2.74, + count: 1, + polygon: [ + [-122.4384025, 37.794807], + [-122.446587, 37.7937653], + [-122.4464465, 37.792813699999996], + [-122.447303, 37.798459199999996], + [-122.4473414, 37.7985527], + [-122.4478196, 37.8016332], + [-122.4479216, 37.8015323], + [-122.4483597, 37.8015868], + [-122.4488026, 37.801772], + [-122.4491786, 37.8020739], + [-122.4494602, 37.8024543], + [-122.4495655, 37.8027914], + [-122.4495837, 37.8031531], + [-122.4494957, 37.8034703], + [-122.4493881, 37.8037108], + [-122.4491242, 37.8040079], + [-122.4488145, 37.8042286], + [-122.4482407, 37.8044777], + [-122.4483233, 37.8050078], + [-122.4485291, 37.8067632], + [-122.4483226, 37.8068106], + [-122.4481598, 37.8068744], + [-122.4478339, 37.8070522], + [-122.4471803, 37.8074771], + [-122.446638, 37.8075252], + [-122.4464767, 37.8075168], + [-122.4452557, 37.8076269], + [-122.4417181, 37.8077876], + [-122.4418195, 37.8078923], + [-122.4419352, 37.8078808], + [-122.4419435, 37.8078669], + [-122.4418599, 37.8077804], + [-122.4418735, 37.8077713], + [-122.4419766, 37.8078774], + [-122.4419771, 37.8078952], + [-122.4418165, 37.8079116], + [-122.4418236, 37.8079843], + [-122.4423208, 37.8079321], + [-122.4423776, 37.8079182], + ], + __timestamp: null, + elevation: 1000, + extraProps: { population: 79407, area: 8.9 }, + }, + ], + mapboxApiKey: + 'pk.eyJ1Ijoia3Jpc3R3IiwiYSI6ImNqbGg1N242NTFlczczdnBhazViMjgzZ2sifQ.lUneM-o3NucXN189EYyXxQ', + metricLabels: ['count'], + }, +};