From 22aadba3fd9c30779373bc401bf3547e02e38a50 Mon Sep 17 00:00:00 2001 From: mutantsan Date: Fri, 6 Dec 2024 09:57:19 +0200 Subject: [PATCH] fix: fix plotly line multiple y-axis extra scale --- ckanext/charts/chart_builders/plotly.py | 5 +++-- ckanext/charts/utils.py | 2 +- pyproject.toml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ckanext/charts/chart_builders/plotly.py b/ckanext/charts/chart_builders/plotly.py index 75c4e98..b73449f 100644 --- a/ckanext/charts/chart_builders/plotly.py +++ b/ckanext/charts/chart_builders/plotly.py @@ -12,6 +12,9 @@ from ckanext.charts import exception from ckanext.charts.chart_builders.base import BaseChartBuilder, BaseChartForm +# silence SettingWithCopyWarning +pd.options.mode.chained_assignment = None + class PlotlyBuilder(BaseChartBuilder): """Base class for Plotly chart builders. @@ -182,7 +185,6 @@ def build_line_chart(self) -> Any: name=self.settings["y"][0], connectgaps=not self.settings.get("break_chart"), ), - secondary_y=False, ) if len(self.settings["y"]) > 1: @@ -196,7 +198,6 @@ def build_line_chart(self) -> Any: name=column, connectgaps=not self.settings.get("break_chart"), ), - secondary_y=True, ) if self.settings.get("split_data") and len(self.settings["years"]) > 1: diff --git a/ckanext/charts/utils.py b/ckanext/charts/utils.py index 9085910..9e6fe49 100644 --- a/ckanext/charts/utils.py +++ b/ckanext/charts/utils.py @@ -112,7 +112,7 @@ def _build_chart(settings: dict[str, Any], dataframe: pd.DataFrame) -> str | Non except KeyError as e: raise ChartBuildError(f"Missing column or field {e}") from e except ValueError as e: - raise ChartBuildError from e + raise ChartBuildError(str(e)) from e return chart_config diff --git a/pyproject.toml b/pyproject.toml index e036bec..23a48b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ dependencies = [ ] license = {text = "AGPL"} requires-python = ">=3.8" -version = "1.1.2" +version = "1.1.21" [project.optional-dependencies] pyarrow = ["pyarrow>=16.0.0,<17.0.0"]