gov-uk-dashboards 16.1.0__py3-none-any.whl → 16.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gov_uk_dashboards/components/plotly/time_series_chart.py +16 -0
- {gov_uk_dashboards-16.1.0.dist-info → gov_uk_dashboards-16.2.0.dist-info}/METADATA +1 -1
- {gov_uk_dashboards-16.1.0.dist-info → gov_uk_dashboards-16.2.0.dist-info}/RECORD +6 -6
- {gov_uk_dashboards-16.1.0.dist-info → gov_uk_dashboards-16.2.0.dist-info}/WHEEL +0 -0
- {gov_uk_dashboards-16.1.0.dist-info → gov_uk_dashboards-16.2.0.dist-info}/licenses/LICENSE +0 -0
- {gov_uk_dashboards-16.1.0.dist-info → gov_uk_dashboards-16.2.0.dist-info}/top_level.txt +0 -0
@@ -156,6 +156,7 @@ class TimeSeriesChart:
|
|
156
156
|
line={"color": line_color},
|
157
157
|
hoverinfo="skip", # 👈 This line disables hover for this trace
|
158
158
|
showlegend=False, # Optional: hide it from legend too
|
159
|
+
legendgroup=self.additional_line["legend_group"],
|
159
160
|
)
|
160
161
|
fig.add_trace(trace_connector)
|
161
162
|
# pylint: disable=unused-variable
|
@@ -173,12 +174,14 @@ class TimeSeriesChart:
|
|
173
174
|
marker_sizes = [0] + [12] * (len(df.with_row_count()) - 1)
|
174
175
|
else:
|
175
176
|
marker_sizes = [12] * (len(df.with_row_count()))
|
177
|
+
legendgroup = self._get_legend_group(df)
|
176
178
|
fig.add_trace(
|
177
179
|
self.create_time_series_trace(
|
178
180
|
df.sort(self.x_axis_column),
|
179
181
|
trace_name,
|
180
182
|
line_style={"dash": "solid", "color": colour},
|
181
183
|
marker={"symbol": marker, "size": marker_sizes, "opacity": 1},
|
184
|
+
legendgroup=legendgroup,
|
182
185
|
),
|
183
186
|
)
|
184
187
|
|
@@ -220,6 +223,7 @@ class TimeSeriesChart:
|
|
220
223
|
]
|
221
224
|
|
222
225
|
hover_text_full = hover_text + hover_text[::-1]
|
226
|
+
legendgroup = self._get_legend_group(fill_df)
|
223
227
|
fig.add_trace(
|
224
228
|
go.Scatter(
|
225
229
|
x=x_series + x_series[::-1],
|
@@ -232,6 +236,7 @@ class TimeSeriesChart:
|
|
232
236
|
name=self.filled_traces_dict["name"] + LEGEND_SPACING,
|
233
237
|
hovertemplate=hover_text_full,
|
234
238
|
hoveron="points",
|
239
|
+
legendgroup=legendgroup,
|
235
240
|
)
|
236
241
|
)
|
237
242
|
self._format_x_axis(fig)
|
@@ -299,6 +304,14 @@ class TimeSeriesChart:
|
|
299
304
|
)
|
300
305
|
return fig
|
301
306
|
|
307
|
+
def _get_legend_group(self, df):
|
308
|
+
if "legend_group" in df.columns and len(df) > 0:
|
309
|
+
value = df["legend_group"][0]
|
310
|
+
legendgroup = value if value is not None else None
|
311
|
+
else:
|
312
|
+
legendgroup = None
|
313
|
+
return legendgroup
|
314
|
+
|
302
315
|
# pylint: disable=duplicate-code
|
303
316
|
def _format_x_axis(self, fig):
|
304
317
|
tick_text, tick_values, range_x = self._get_x_axis_content()
|
@@ -317,6 +330,7 @@ class TimeSeriesChart:
|
|
317
330
|
trace_name: str,
|
318
331
|
line_style: dict[str, str],
|
319
332
|
marker: dict[str, str],
|
333
|
+
legendgroup: str,
|
320
334
|
):
|
321
335
|
"""Creates a trace for the plot.
|
322
336
|
|
@@ -326,6 +340,7 @@ class TimeSeriesChart:
|
|
326
340
|
trace_name (str): Name of trace.
|
327
341
|
line_style (dict[str, str]): Properties for line_style parameter.
|
328
342
|
marker (dict[str,str]): Properties for marker parameter.
|
343
|
+
legendgroup (str): Name to group by in legend,
|
329
344
|
"""
|
330
345
|
return go.Scatter(
|
331
346
|
x=df[self.x_axis_column],
|
@@ -339,6 +354,7 @@ class TimeSeriesChart:
|
|
339
354
|
showlegend=(
|
340
355
|
trace_name in self.legend_dict if self.legend_dict is not None else True
|
341
356
|
),
|
357
|
+
legendgroup=legendgroup,
|
342
358
|
)
|
343
359
|
|
344
360
|
def _get_hover_template(self, df, trace_name):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: gov_uk_dashboards
|
3
|
-
Version: 16.
|
3
|
+
Version: 16.2.0
|
4
4
|
Summary: Provides access to functionality common to creating a data dashboard.
|
5
5
|
Author: Department for Levelling Up, Housing and Communities
|
6
6
|
Description-Content-Type: text/markdown
|
@@ -79,7 +79,7 @@ gov_uk_dashboards/components/plotly/captioned_figure.py,sha256=T0sbtGTiJ79FXxVdP
|
|
79
79
|
gov_uk_dashboards/components/plotly/choropleth_map.py,sha256=U9RmS3MZGloQAt9HoSYh3Xad205DDfZOjz91ZD_ydbI,9849
|
80
80
|
gov_uk_dashboards/components/plotly/enums.py,sha256=ebHiFQljA7O4HJxKoslqlNXcAjUZi1askpTSwxKEcYQ,850
|
81
81
|
gov_uk_dashboards/components/plotly/stacked_barchart.py,sha256=_81WlxelE5Gxozj80uYRIkQJLyv2i6xZr2T0g3db4ks,12229
|
82
|
-
gov_uk_dashboards/components/plotly/time_series_chart.py,sha256=
|
82
|
+
gov_uk_dashboards/components/plotly/time_series_chart.py,sha256=Z8p4oQ6ohiv7qaIVC6oDUEdVteryvIr7YuzQL0RpYyU,22701
|
83
83
|
gov_uk_dashboards/figures/__init__.py,sha256=_snQeNlM81nNKERl4gg9ScH2HYbtwaBjl8yQonccx34,712
|
84
84
|
gov_uk_dashboards/figures/chart_data.py,sha256=fEsNkQFzXKIQ0h7aLBWq3J1qAxHbxvJeKU23JrVodVc,757
|
85
85
|
gov_uk_dashboards/figures/line_chart.py,sha256=rEB51_z9cPl7BcT94iA6ZsZXzecnVCnGpQWW_9SNGUY,2813
|
@@ -100,8 +100,8 @@ gov_uk_dashboards/lib/dap/dap_deployment.py,sha256=ZXixeOAtRNjMsPdGKLwwLNamlo0mi
|
|
100
100
|
gov_uk_dashboards/lib/dap/get_dataframe_from_cds.py,sha256=OiusRCgYnkBjK_GZgYLGzNrxOGizYt8CgThiWRCVKK0,3921
|
101
101
|
gov_uk_dashboards/lib/datetime_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
102
102
|
gov_uk_dashboards/lib/datetime_functions/datetime_functions.py,sha256=BQgr8I_vFNYwLi-fE4YC6jZ5PpbPea2rnD_2a_lw0YE,12209
|
103
|
-
gov_uk_dashboards-16.
|
104
|
-
gov_uk_dashboards-16.
|
105
|
-
gov_uk_dashboards-16.
|
106
|
-
gov_uk_dashboards-16.
|
107
|
-
gov_uk_dashboards-16.
|
103
|
+
gov_uk_dashboards-16.2.0.dist-info/licenses/LICENSE,sha256=GDiD7Y2Gx7JucPV1JfVySJeah-qiSyBPdpJ6RHCEHTc,1126
|
104
|
+
gov_uk_dashboards-16.2.0.dist-info/METADATA,sha256=XWp4ZyTku_CZxzeDiuTCSLoaKUYREIvZO6olgDyxhZA,5917
|
105
|
+
gov_uk_dashboards-16.2.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
106
|
+
gov_uk_dashboards-16.2.0.dist-info/top_level.txt,sha256=gPaN1P3-H3Rgi2me6tt-fX_cxo19CZfA4PjlZPjGRpo,18
|
107
|
+
gov_uk_dashboards-16.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|