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

feat: component api support poi chart #602

Merged
merged 1 commit into from
Jul 31, 2024
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 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
Loading