Skip to content

Commit

Permalink
feat: component api support poi chart
Browse files Browse the repository at this point in the history
  • Loading branch information
longxiaofei committed Jul 31, 2024
1 parent 787dadd commit 754bf70
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pygwalker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pygwalker.services.global_var import GlobalVarManager
from pygwalker.services.kaggle import show_tips_user_kaggle as __show_tips_user_kaggle

__version__ = "0.4.9.4a1"
__version__ = "0.4.9.4a2"
__hash__ = __rand_str()

from pygwalker.api.jupyter import walk, render, table
Expand Down
23 changes: 22 additions & 1 deletion pygwalker/api/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


GRAPHIC_WALKER_AGG_FUNCS = {
"sum", "mean", "median", "count",
"sum", "mean", "median",
"min", "max", "variance", "stddev",
}

Expand Down Expand Up @@ -42,6 +42,8 @@ def _convert_sql_to_field(sql: str, is_agg_sql: bool) -> Dict[str, Any]:
}
if is_agg_sql:
field_item["aggName"] = "expr"
field_item["analyticType"] = "measure"
field_item["semanticType"] = "quantitative"
return field_item


Expand Down Expand Up @@ -214,72 +216,91 @@ def bar(self) -> "Component":
"""Bar chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["bar"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def line(self) -> "Component":
"""Line chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["line"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def area(self) -> "Component":
"""Area chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["area"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def trail(self) -> "Component":
"""Trail chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["trail"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def scatter(self) -> "Component":
"""Scatter chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["point"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def circle(self) -> "Component":
"""Circle chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["circle"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def tick(self) -> "Component":
"""Tick chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["tick"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def rect(self) -> "Component":
"""Rect chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["rect"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def arc(self) -> "Component":
"""Arc chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["arc"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def text(self) -> "Component":
"""Text chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["text"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def box(self) -> "Component":
"""Box chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["boxplot"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def table(self) -> "Component":
"""Table chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["table"])
copied_obj._update_single_chart_spec("config__coordSystem", "generic")
return copied_obj

def poi(self) -> "Component":
"""Poi chart."""
copied_obj = self.copy()
copied_obj._update_single_chart_spec("config__geoms", ["poi"])
copied_obj._update_single_chart_spec("config__coordSystem", "geographic")
return copied_obj

# pylint: disable=unused-argument
Expand Down

0 comments on commit 754bf70

Please sign in to comment.