-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
feat: Add line width unit control in deckgl Polygon and Path #24755
Merged
kgabryje
merged 6 commits into
apache:master
from
kgabryje:feat/deckgl-path-width-units
Jul 27, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9e2011d
Add line width unit control to Path
kgabryje 9ea7588
Add line width unit to Polygons
kgabryje c6c6a17
Update down revision id
kgabryje 6ce55e3
Optimise migration
kgabryje f4ed738
Add line width unit to example chart
kgabryje f517ac6
Update down revision id
kgabryje File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -387,6 +387,8 @@ def load_deck_dash() -> None: # pylint: disable=too-many-statements | |
"stroked": False, | ||
"extruded": True, | ||
"multiplier": 0.1, | ||
"line_width": 10, | ||
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. Shouldn't we also add 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. Great catch! |
||
"line_width_unit": "meters", | ||
"point_radius_fixed": { | ||
"type": "metric", | ||
"value": { | ||
|
70 changes: 70 additions & 0 deletions
70
superset/migrations/versions/2023-07-19_17-54_ee179a490af9_deckgl_path_width_units.py
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,70 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
"""deckgl-path-width-units | ||
|
||
Revision ID: ee179a490af9 | ||
Revises: a23c6f8b1280 | ||
Create Date: 2023-07-19 17:54:06.752360 | ||
|
||
""" | ||
import json | ||
import logging | ||
|
||
from alembic import op | ||
from sqlalchemy import Column, Integer, or_, String, Text | ||
from sqlalchemy.ext.declarative import declarative_base | ||
|
||
from superset import db | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "ee179a490af9" | ||
down_revision = "a23c6f8b1280" | ||
|
||
|
||
Base = declarative_base() | ||
|
||
|
||
class Slice(Base): | ||
__tablename__ = "slices" | ||
id = Column(Integer, primary_key=True) | ||
viz_type = Column(String(250)) | ||
params = Column(Text) | ||
|
||
|
||
def upgrade(): | ||
bind = op.get_bind() | ||
session = db.Session(bind=bind) | ||
for slc in session.query(Slice).filter( | ||
or_( | ||
Slice.viz_type == "deck_path", | ||
Slice.viz_type == "deck_geojson", | ||
Slice.viz_type == "deck_polygon", | ||
) | ||
): | ||
try: | ||
params = json.loads(slc.params) | ||
if not params.get("line_width_unit"): | ||
params["line_width_unit"] = "meters" | ||
slc.params = json.dumps(params) | ||
except Exception: | ||
logging.exception(f"Unable to parse params for slice {slc.id}") | ||
session.commit() | ||
session.close() | ||
|
||
|
||
def downgrade(): | ||
pass |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Finally these are split onto their own rows 👏
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'm going to do the same in the rest of deckgl plugins in upcoming PRs, no more controls squished in 1 row 😄