From 4ce241fc9e7d2c0a8d83599b4e80fca6cbed4eff Mon Sep 17 00:00:00 2001 From: cirun Date: Mon, 29 Jul 2024 18:23:45 +0200 Subject: [PATCH] LLCAXCHZF-57/add engine details field --- ckanext/charts/chart_builders/base.py | 11 ++++++ ckanext/charts/chart_builders/chartjs.py | 5 +++ ckanext/charts/chart_builders/observable.py | 5 +++ ckanext/charts/chart_builders/plotly.py | 4 +++ .../form_snippets/chart_engine_details.html | 34 +++++++++++++++++++ 5 files changed, 59 insertions(+) create mode 100644 ckanext/charts/templates/scheming/form_snippets/chart_engine_details.html diff --git a/ckanext/charts/chart_builders/base.py b/ckanext/charts/chart_builders/base.py index 58d4690..94dd3f7 100644 --- a/ckanext/charts/chart_builders/base.py +++ b/ckanext/charts/chart_builders/base.py @@ -649,3 +649,14 @@ def filter_field(self, choices: list[dict[str, str]]) -> dict[str, Any]: ], "group": "Filter", } + + def engine_details_field(self) -> dict[str, Any]: + """ + Provides details about zoom functionality support in various charting libraries. + """ + return { + "field_name": "engine_details", + "label": "Engine details", + "form_snippet": "chart_engine_details.html", + "group": "Structure", + } diff --git a/ckanext/charts/chart_builders/chartjs.py b/ckanext/charts/chart_builders/chartjs.py index 9c2e529..96a11a5 100644 --- a/ckanext/charts/chart_builders/chartjs.py +++ b/ckanext/charts/chart_builders/chartjs.py @@ -119,6 +119,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_multi_axis_field(columns), self.limit_field(), @@ -185,6 +186,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_multi_axis_field(columns), self.sort_x_field(), @@ -243,6 +245,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.values_field(columns), self.names_field(columns), self.limit_field(), @@ -308,6 +311,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_axis_field(columns), self.sort_x_field(), @@ -432,6 +436,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.names_field(columns), self.values_multi_field( columns, diff --git a/ckanext/charts/chart_builders/observable.py b/ckanext/charts/chart_builders/observable.py index 286da57..0c1bb47 100644 --- a/ckanext/charts/chart_builders/observable.py +++ b/ckanext/charts/chart_builders/observable.py @@ -52,6 +52,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_axis_field(columns), self.sort_x_field(), @@ -110,6 +111,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_axis_field(columns), self.invert_x_field(), @@ -185,6 +187,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.values_field(columns), self.names_field(columns), self.opacity_field(), @@ -225,6 +228,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_axis_field(columns), self.sort_x_field(), @@ -263,6 +267,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_axis_field(columns), self.sort_x_field(), diff --git a/ckanext/charts/chart_builders/plotly.py b/ckanext/charts/chart_builders/plotly.py index 781971c..42ac2a3 100644 --- a/ckanext/charts/chart_builders/plotly.py +++ b/ckanext/charts/chart_builders/plotly.py @@ -110,6 +110,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_axis_field(columns), self.log_x_field(), @@ -141,6 +142,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.values_field(columns), self.names_field(columns), self.opacity_field(), @@ -183,6 +185,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.plotly_y_multi_axis_field(columns, 2), self.invert_x_field(), @@ -227,6 +230,7 @@ def get_form_fields(self): self.description_field(), self.engine_field(), self.type_field(chart_types), + self.engine_details_field(), self.x_axis_field(columns), self.y_axis_field(columns), self.log_x_field(), diff --git a/ckanext/charts/templates/scheming/form_snippets/chart_engine_details.html b/ckanext/charts/templates/scheming/form_snippets/chart_engine_details.html new file mode 100644 index 0000000..c3a0e96 --- /dev/null +++ b/ckanext/charts/templates/scheming/form_snippets/chart_engine_details.html @@ -0,0 +1,34 @@ +
+
+ +
+
+ + +