-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Carto: Support styling layer by color column #8177
Carto: Support styling layer by color column #8177
Conversation
modules/carto/src/api/layer-map.ts
Outdated
@@ -380,6 +372,33 @@ export function getColorAccessor( | |||
return normalizeAccessor(accessor, data); | |||
} | |||
|
|||
export function getDomainAndScaleColor(name, scaleType, range, data) { |
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 do you need to introduce this new function? I feel it just makes the code harder to follow
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.
I don't need but I think that it's more clear than having a long function. This function is just calculating the domain
and scaleColor
for each case.
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.
OK, but can your rename to calculateLayerScale
, remove the export
and put these three lines in the helper function:
scale.domain(domain);
scale.range(scaleColor);
scale.unknown(UNKNOWN_COLOR);
and then just return the scale
modules/carto/src/api/layer-map.ts
Outdated
@@ -380,6 +372,33 @@ export function getColorAccessor( | |||
return normalizeAccessor(accessor, data); | |||
} | |||
|
|||
export function getDomainAndScaleColor(name, scaleType, range, data) { |
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.
OK, but can your rename to calculateLayerScale
, remove the export
and put these three lines in the helper function:
scale.domain(domain);
scale.range(scaleColor);
scale.unknown(UNKNOWN_COLOR);
and then just return the scale
…f github.com:visgl/deck.gl into feature/sc-353849/apply-hexcolor-to-deck-gl-fetchmap
Background
Allow to style a layer using the a color property.
Change List
HexColor column
infetchMap