You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/01/23 22:12:01 UTC
[GitHub] hughhhh closed pull request #4238: [Bugfix] Update on srcs and added JS controls
hughhhh closed pull request #4238: [Bugfix] Update on srcs and added JS controls
URL: https://github.com/apache/incubator-superset/pull/4238
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/assets/javascripts/explore/stores/visTypes.js b/superset/assets/javascripts/explore/stores/visTypes.js
index b175ff3fa8..67be0834f1 100644
--- a/superset/assets/javascripts/explore/stores/visTypes.js
+++ b/superset/assets/javascripts/explore/stores/visTypes.js
@@ -582,6 +582,15 @@ export const visTypes = {
['stroke_width', null],
],
},
+ {
+ label: t('Advanced'),
+ controlSetRows: [
+ ['js_columns'],
+ ['js_datapoint_mutator'],
+ ['js_tooltip'],
+ ['js_onclick_href'],
+ ],
+ },
],
},
diff --git a/superset/assets/visualizations/deckgl/layers/arc.jsx b/superset/assets/visualizations/deckgl/layers/arc.jsx
index 38bd1e826f..c80a486f51 100644
--- a/superset/assets/visualizations/deckgl/layers/arc.jsx
+++ b/superset/assets/visualizations/deckgl/layers/arc.jsx
@@ -1,16 +1,26 @@
import { ArcLayer } from 'deck.gl';
-export default function arcLayer(formData, payload) {
+import * as common from './common';
+import sandboxedEval from '../../../javascripts/modules/sandbox';
+
+export default function arcLayer(formData, payload, slice) {
const fd = formData;
const fc = fd.color_picker;
- const data = payload.data.arcs.map(d => ({
+ let data = payload.data.arcs.map(d => ({
...d,
color: [fc.r, fc.g, fc.b, 255 * fc.a],
}));
+ if (fd.js_datapoint_mutator) {
+ // Applying user defined data mutator if defined
+ const jsFnMutator = sandboxedEval(fd.js_datapoint_mutator);
+ data = data.map(jsFnMutator);
+ }
+
return new ArcLayer({
id: `path-layer-${fd.slice_id}`,
data,
strokeWidth: (fd.stroke_width) ? fd.stroke_width : 3,
+ ...common.commonLayerProps(fd, slice),
});
}
diff --git a/superset/viz.py b/superset/viz.py
index 165d4a1e64..8d0679359b 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -2071,7 +2071,7 @@ def get_data(self, df):
arcs = d['features']
return {
- 'arcs': [arc['position'] for arc in arcs],
+ 'arcs': arcs,
'mapboxApiKey': config.get('MAPBOX_API_KEY'),
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services