This is an automated email from the ASF dual-hosted git repository. maximebeauchemin pushed a commit to branch echarts_poc in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit 682101cd88d2bd58bcaee1c6e3c3c0b1ab364d02 Author: Maxime Beauchemin <[email protected]> AuthorDate: Sun Sep 15 21:19:04 2019 -0700 [POC] add echarts scatter --- .../explore/components/controls/VizTypeControl.jsx | 2 +- .../src/explore/controlPanels/EchartsScatter.js | 69 ++++++++++++++++++++++ superset/assets/src/explore/controlPanels/index.js | 2 + .../src/visualizations/presets/MainPreset.js | 2 + superset/viz.py | 9 +++ 5 files changed, 83 insertions(+), 1 deletion(-) diff --git a/superset/assets/src/explore/components/controls/VizTypeControl.jsx b/superset/assets/src/explore/components/controls/VizTypeControl.jsx index cf3c8c9..78d554c 100644 --- a/superset/assets/src/explore/components/controls/VizTypeControl.jsx +++ b/superset/assets/src/explore/components/controls/VizTypeControl.jsx @@ -53,7 +53,7 @@ const DEFAULT_ORDER = [ 'mapbox', 'kepler', 'cal_heatmap', 'rose', 'bubble', 'deck_geojson', 'horizon', 'markup', 'deck_multi', 'compare', 'partition', 'event_flow', 'deck_path', 'directed_force', 'world_map', 'paired_ttest', 'para', - 'iframe', 'country_map', + 'iframe', 'country_map', 'echarts_scatter', ]; const typesWithDefaultOrder = new Set(DEFAULT_ORDER); diff --git a/superset/assets/src/explore/controlPanels/EchartsScatter.js b/superset/assets/src/explore/controlPanels/EchartsScatter.js new file mode 100644 index 0000000..891fe29 --- /dev/null +++ b/superset/assets/src/explore/controlPanels/EchartsScatter.js @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { t } from '@superset-ui/translation'; + +export default { + label: t('Bubble Chart'), + controlPanelSections: [ + { + label: t('Query'), + expanded: true, + controlSetRows: [ + ['series', 'entity'], + ['x'], + ['y'], + ['adhoc_filters'], + ['size'], + ['max_bubble_size'], + ['limit', null], + ], + }, + { + label: t('Chart Options'), + expanded: true, + controlSetRows: [ + ['color_scheme', 'label_colors'], + ['show_legend', null], + ], + }, + { + label: t('X Axis'), + expanded: true, + controlSetRows: [ + ['x_axis_label', 'left_margin'], + ['x_axis_format', 'x_ticks_layout'], + ['x_log_scale', 'x_axis_showminmax'], + ], + }, + { + label: t('Y Axis'), + expanded: true, + controlSetRows: [ + ['y_axis_label', 'bottom_margin'], + ['y_axis_format', null], + ['y_log_scale', 'y_axis_showminmax'], + ], + }, + ], + controlOverrides: { + color_scheme: { + renderTrigger: false, + }, + }, +}; diff --git a/superset/assets/src/explore/controlPanels/index.js b/superset/assets/src/explore/controlPanels/index.js index e663f54..8df25db 100644 --- a/superset/assets/src/explore/controlPanels/index.js +++ b/superset/assets/src/explore/controlPanels/index.js @@ -30,6 +30,7 @@ import BigNumber from './BigNumber'; import BigNumberTotal from './BigNumberTotal'; import BoxPlot from './BoxPlot'; import Bubble from './Bubble'; +import EchartsScatter from './EchartsScatter'; import Bullet from './Bullet'; import CalHeatmap from './CalHeatmap'; import Chord from './Chord'; @@ -80,6 +81,7 @@ export const controlPanelConfigs = extraOverrides({ big_number_total: BigNumberTotal, box_plot: BoxPlot, bubble: Bubble, + echarts_scatter: EchartsScatter, bullet: Bullet, cal_heatmap: CalHeatmap, chord: Chord, diff --git a/superset/assets/src/visualizations/presets/MainPreset.js b/superset/assets/src/visualizations/presets/MainPreset.js index 9dc3f81..90130e7 100644 --- a/superset/assets/src/visualizations/presets/MainPreset.js +++ b/superset/assets/src/visualizations/presets/MainPreset.js @@ -26,6 +26,7 @@ import ForceDirectedChartPlugin from '@superset-ui/legacy-plugin-chart-force-dir import HeatmapChartPlugin from '@superset-ui/legacy-plugin-chart-heatmap'; import HistogramChartPlugin from '@superset-ui/legacy-plugin-chart-histogram'; import HorizonChartPlugin from '@superset-ui/legacy-plugin-chart-horizon'; +import EchartsScatterChartPlugin from '@superset-ui/superset-ui-plugin-echarts-scatter/src'; import IframeChartPlugin from '@superset-ui/legacy-plugin-chart-iframe'; import MapBoxChartPlugin from '@superset-ui/legacy-plugin-chart-map-box'; import MarkupChartPlugin from '@superset-ui/legacy-plugin-chart-markup'; @@ -102,6 +103,7 @@ export default class MainPreset extends Preset { new TreemapChartPlugin().configure({ key: 'treemap' }), new WordCloudChartPlugin().configure({ key: 'word_cloud' }), new WorldMapChartPlugin().configure({ key: 'world_map' }), + new EchartsScatterChartPlugin().configure({ key: 'echarts_scatter' }), ], }); } diff --git a/superset/viz.py b/superset/viz.py index edd5b1c..4203566 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -2765,6 +2765,15 @@ class PartitionViz(NVD3TimeSeriesViz): return self.nest_values(levels) +class EchartsScatter(BubbleViz): + + """Based on the NVD3 bubble chart""" + + viz_type = "echarts_scatter" + verbose_name = _("Bubble Chart") + is_timeseries = False + + viz_types = { o.viz_type: o for o in globals().values()
