Skip to content

Commit

Permalink
Resolve empty vis bug for geographic data types (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
micahtyong committed Mar 23, 2021
1 parent 10a2273 commit 2553125
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lux/vislib/altair/Choropleth.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ def initialize_chart(self):
alt.Chart(geo_map)
.mark_geoshape()
.encode(
color=f"{y_attr_abv}:Q",
color=f"{str(y_attr.attribute)}:Q",
)
.transform_lookup(
lookup="id",
from_=alt.LookupData(self.data, str(x_attr.attribute), [str(y_attr.attribute)]),
)
.transform_lookup(lookup="id", from_=alt.LookupData(self.data, x_attr_abv, [y_attr_abv]))
.project(type=map_type)
.properties(
width=width, height=height, title=f"Mean of {y_attr_abv} across {geographical_name}"
Expand All @@ -91,10 +94,10 @@ def initialize_chart(self):
background = {background_str}
points = alt.Chart({geo_map_str}).mark_geoshape().encode(
color='{y_attr_abv}:Q',
color='{str(y_attr.attribute)}:Q',
).transform_lookup(
lookup='id',
from_=alt.LookupData({dfname}, "{x_attr_abv}", ["{y_attr_abv}"])
from_=alt.LookupData({dfname}, "{str(x_attr.attribute)}", ["{str(y_attr.attribute)}"])
).project(
type="{map_type}"
).properties(
Expand Down

0 comments on commit 2553125

Please sign in to comment.