forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using user-defined Javascript to customize geospatial visualization (a…
…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
- Loading branch information
1 parent
4880c82
commit 59ea9f3
Showing
13 changed files
with
237 additions
and
54 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.chart-tooltip { | ||
opacity: 0.75; | ||
font-size: 12px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import dompurify from 'dompurify'; | ||
import sandboxedEval from '../../../javascripts/modules/sandbox'; | ||
|
||
export function commonLayerProps(formData, slice) { | ||
const fd = formData; | ||
let onHover; | ||
if (fd.js_tooltip) { | ||
const jsTooltip = sandboxedEval(fd.js_tooltip); | ||
onHover = (o) => { | ||
if (o.picked) { | ||
slice.setTooltip({ | ||
content: dompurify.sanitize(jsTooltip(o)), | ||
x: o.x, | ||
y: o.y, | ||
}); | ||
} else { | ||
slice.setTooltip(null); | ||
} | ||
}; | ||
} | ||
let onClick; | ||
if (fd.js_onclick_href) { | ||
onClick = (o) => { | ||
const href = sandboxedEval(fd.js_onclick_href)(o); | ||
window.open(href); | ||
}; | ||
} | ||
return { | ||
onClick, | ||
onHover, | ||
pickable: Boolean(onHover), | ||
}; | ||
} |
Oops, something went wrong.