-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using user-defined Javascript to customize geospatial visualization #4173
Conversation
78b267a
to
df22f29
Compare
f6a53c6
to
dd1735f
Compare
const fd = formData; | ||
const fc = fd.fill_color_picker; | ||
const sc = fd.stroke_color_picker; | ||
const data = payload.data.geojson.features.map(d => ({ | ||
let data = payload.data.geojson.features.map(d => ({ | ||
...d, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why let instead of const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now data
can be mutated (see below, line 44).
superset/viz.py
Outdated
@@ -1876,8 +1882,12 @@ def get_data(self, df): | |||
|
|||
features = [] | |||
for d in df.to_dict(orient='records'): | |||
d = dict(position=self.get_position(d), **self.get_properties(d)) | |||
features.append(d) | |||
print(d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove print
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
🚢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3 this
superset/viz.py
Outdated
d['columns'] = [self.form_data.get('line_column')] | ||
line_col = self.form_data.get('line_column') | ||
if d['metrics']: | ||
d['groupby'] += [line_col] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No love for .append()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorthand all day 💯 @betodealmeida
…pache#4173) * Using JS to customize spatial viz and tooltips * Add missing deck_multi.png * Improve GeoJSON layer with JS support and extra controls * Addressing comments
…pache#4173) * Using JS to customize spatial viz and tooltips * Add missing deck_multi.png * Improve GeoJSON layer with JS support and extra controls * Addressing comments
Proof of concept on custom user-provided JS on
deck_path
andeck_scatter
visualizations. Users can pick extra data columns that become available in their javascript functions' scope.Users can pass 3 javascript snippet to respectively: