Skip to content
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 opacity #1447

Merged
merged 1 commit into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/animation_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def animation_layer(
color (str, optional): Hex, rgb or named color value. Default is '#EE5D5A' for point geometries,
'#4CC8A3' for lines and #826DBA for polygons.
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/cluster_size_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def cluster_size_layer(
resolution (int, optional): Resolution of aggregation grid cell. Set to 32 by default.
title (str, optional): Title of legend and hover.
color (str, optional): Hex, rgb or named color value. Defaults is '#FFB927' for point geometries.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/color_bins_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def color_bins_layer(
or other valid color palette. Use `help(cartoframes.viz.color_palettes)` to
get more information. Default is "purpor".
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/color_category_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def color_category_layer(
or other valid color palette. Use `help(cartoframes.viz.color_palettes)` to
get more information. Default is "bold".
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/color_continuous_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def color_continuous_layer(
or other valid color palette. Use `help(cartoframes.viz.color_palettes)` to
get more information. Default is "bluyl".
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/isolines_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def isolines_layer(source, value=RANGE_LABEL_KEY, **kwargs):
or other valid color palette. Use `help(cartoframes.viz.color_palettes)` to
get more information. Default is "bold".
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/size_bins_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def size_bins_layer(
'[2, 14]' for point geometries and '[1, 10]' for lines.
color (str, optional): Hex, rgb or named color value. Default is '#EE5D5A' for point geometries and
'#4CC8A3' for lines.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/size_category_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def size_category_layer(
'[2, 20]' for point geometries and '[1, 10]' for lines.
color (str, optional): Hex, rgb or named color value. Default is '#F46D43' for point geometries and
'#4CC8A3' for lines.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/layers/size_continuous_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def size_continuous_layer(
'[2, 40]' for point geometries and '[1, 10]' for lines.
color (str, optional): Hex, rgb or named color value. Defaults is '#FFB927' for point geometries and
'#4CC8A3' for lines.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/animation_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def animation_style(value, duration=20, color=None, size=None, opacity=None,
color (str, optional): Hex, rgb or named color value. Default is '#EE5D5A' for point geometries,
'#4CC8A3' for lines and #826DBA for polygons.
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_width (int, optional): Size of the stroke on point features.
stroke_color (str, optional): Color of the stroke on point features.
Expand Down
24 changes: 15 additions & 9 deletions cartoframes/viz/styles/basic_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def basic_style(color=None, size=None, opacity=None, stroke_color=None, stroke_w
color (str, optional): hex, rgb or named color value.
Defaults is '#FFB927' for point geometries and '#4CC8A3' for lines.
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features from 0 to 1
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
stroke_width (int, optional): Size of the stroke on point features.
Expand All @@ -22,22 +22,28 @@ def basic_style(color=None, size=None, opacity=None, stroke_color=None, stroke_w
"""
data = {
'point': {
'color': get_value(color, 'color', 'point'),
'color': 'opacity({0}, {1})'.format(
get_value(color, 'color', 'point'),
get_value(opacity, 1)
),
'width': get_value(size, 'width', 'point'),
'strokeColor': get_value(stroke_color, 'strokeColor', 'point'),
'strokeWidth': get_value(stroke_width, 'strokeWidth', 'point'),
'filter': get_value(opacity, 1)
},
'line': {
'color': get_value(color, 'color', 'line'),
'width': get_value(size, 'width', 'line'),
'filter': get_value(opacity, 1)
'color': 'opacity({0}, {1})'.format(
get_value(color, 'color', 'line'),
get_value(opacity, 1)
),
'width': get_value(size, 'width', 'line')
},
'polygon': {
'color': get_value(color, 'color', 'polygon'),
'color': 'opacity({0}, {1})'.format(
get_value(color, 'color', 'polygon'),
get_value(opacity, 0.9)
),
'strokeColor': get_value(stroke_color, 'strokeColor', 'polygon'),
'strokeWidth': get_value(stroke_width, 'strokeWidth', 'polygon'),
'filter': get_value(opacity, 0.9)
'strokeWidth': get_value(stroke_width, 'strokeWidth', 'polygon')
}
}

Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/cluster_size_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def cluster_size_style(
available are 'avg', 'min', 'max', and 'sum'.
resolution (int, optional): Resolution of aggregation grid cell. Set to 32 by default.
color (str, optional): Hex, rgb or named color value. Defaults is '#FFB927' for point geometries.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/color_bins_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def color_bins_style(
or other valid color palette. Use `help(cartoframes.viz.color_palettes)` to
get more information. Default is "purpor".
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/color_category_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def color_category_style(
or other valid color palette. Use `help(cartoframes.viz.color_palettes)` to
get more information. Default is "bold".
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/color_continuous_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def color_continuous_style(
or other valid color palette. Use `help(cartoframes.viz.color_palettes)` to
get more information. Default is "bluyl".
size (int, optional): Size of point or line features.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/size_bins_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def size_bins_style(
'[2, 14]' for point geometries and '[1, 10]' for lines.
color (str, optional): Hex, rgb or named color value. Default is '#EE5D5A' for point geometries and
'#4CC8A3' for lines.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/size_category_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def size_category_style(
'[2, 20]' for point geometries and '[1, 10]' for lines.
color (str, optional): hex, rgb or named color value.
Default is '#F46D43' for point geometries and '#4CC8A3' for lines.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
Expand Down
2 changes: 1 addition & 1 deletion cartoframes/viz/styles/size_continuous_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def size_continuous_style(
'[2, 40]' for point geometries and '[1, 10]' for lines.
color (str, optional): hex, rgb or named color value.
Defaults is '#FFB927' for point geometries and '#4CC8A3' for lines.
opacity (int, optional): Opacity value for point color and line features.
opacity (float, optional): Opacity value for point color and line features.
Default is '0.8'.
stroke_color (str, optional): Color of the stroke on point features.
Default is '#222'.
Expand Down