-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Fix multilayer geoviz and color picker error #5767
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ function getPoints(data) { | |
return points; | ||
} | ||
|
||
function getLayer(fd, data, slice) { | ||
function getLayer(fd, payload, slice) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, I simplified the |
||
const data = payload.data.features; | ||
const sc = fd.color_picker; | ||
const tc = fd.target_color_picker; | ||
return new ArcLayer({ | ||
|
@@ -40,17 +41,17 @@ function deckArc(slice, payload, setControlValue) { | |
}; | ||
|
||
if (fd.autozoom) { | ||
viewport = common.fitViewport(viewport, getPoints(payload.data.arcs)); | ||
viewport = common.fitViewport(viewport, getPoints(payload.data.features)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: you can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems not.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, you're right. I got confused by the hidden lines, my bad! |
||
} | ||
|
||
ReactDOM.render( | ||
<CategoricalDeckGLContainer | ||
slice={slice} | ||
data={payload.data.arcs} | ||
mapboxApiKey={payload.data.mapboxApiKey} | ||
setControlValue={setControlValue} | ||
viewport={viewport} | ||
getLayer={getLayer} | ||
payload={payload} | ||
/>, | ||
document.getElementById(slice.containerId), | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,18 @@ function getPoints(data) { | |
return data.map(d => d.position); | ||
} | ||
|
||
function getLayer(fd, data, slice) { | ||
const dataWithRadius = data.map((d) => { | ||
function getLayer(fd, payload, slice) { | ||
const dataWithRadius = payload.data.features.map((d) => { | ||
let radius = unitToRadius(fd.point_unit, d.radius) || 10; | ||
if (fd.multiplier) { | ||
radius *= fd.multiplier; | ||
} | ||
return { ...d, radius }; | ||
if (d.color) { | ||
return { ...d, radius }; | ||
} | ||
const c = fd.color_picker || { r: 0, g: 0, b: 0, a: 1 }; | ||
const color = [c.r, c.g, c.b, c.a * 255]; | ||
return { ...d, radius, color }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing this, I think I must've removed it by mistake. |
||
}); | ||
|
||
return new ScatterplotLayer({ | ||
|
@@ -49,11 +54,11 @@ function deckScatter(slice, payload, setControlValue) { | |
ReactDOM.render( | ||
<CategoricalDeckGLContainer | ||
slice={slice} | ||
data={payload.data.features} | ||
mapboxApiKey={payload.data.mapboxApiKey} | ||
setControlValue={setControlValue} | ||
viewport={viewport} | ||
getLayer={getLayer} | ||
payload={payload} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! make sense |
||
/>, | ||
document.getElementById(slice.containerId), | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2161,7 +2161,7 @@ def query_obj(self): | |
fd = self.form_data | ||
|
||
# add NULL filters | ||
if fd.get('filter_nulls'): | ||
if fd.get('filter_nulls', True): | ||
self.add_null_filters() | ||
|
||
d = super(BaseDeckGLViz, self).query_obj() | ||
|
@@ -2409,10 +2409,9 @@ def get_properties(self, d): | |
|
||
def get_data(self, df): | ||
d = super(DeckArc, self).get_data(df) | ||
arcs = d['features'] | ||
|
||
return { | ||
'arcs': arcs, | ||
'features': d['features'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 I think it's good to standardize on the key value here. |
||
'mapboxApiKey': config.get('MAPBOX_API_KEY'), | ||
} | ||
|
||
|
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.
Let's remove
data
from the props, since it can fetched from the payload.