gov-uk-dashboards 16.0.0__tar.gz → 16.2.0__tar.gz

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.
Files changed (113) hide show
  1. {gov_uk_dashboards-16.0.0/gov_uk_dashboards.egg-info → gov_uk_dashboards-16.2.0}/PKG-INFO +1 -1
  2. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/helpers/plotting_helper_functions.py +1 -1
  3. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/plotly/stacked_barchart.py +3 -2
  4. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/plotly/time_series_chart.py +24 -5
  5. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/constants.py +2 -0
  6. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0/gov_uk_dashboards.egg-info}/PKG-INFO +1 -1
  7. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/setup.py +1 -1
  8. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/LICENSE +0 -0
  9. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/MANIFEST.in +0 -0
  10. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/README.md +0 -0
  11. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/__init__.py +0 -0
  12. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/__init__.py +0 -0
  13. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/attach-event-to-dash.js +0 -0
  14. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/dashboard.css +0 -0
  15. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/fonts/bold-affa96571d-v2.woff +0 -0
  16. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
  17. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
  18. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/fonts/light-f591b13f7d-v2.woff +0 -0
  19. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/get_assets_folder.py +0 -0
  20. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/govuk-frontend-3.14.0.min.js +0 -0
  21. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/DLUHC_WHITE_Master_AW_sm.png +0 -0
  22. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/MHCLG-favicon.png +0 -0
  23. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/MHCLG_favicon.png +0 -0
  24. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/dcms_coatofarms.png +0 -0
  25. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/dluhc_favicon.ico +0 -0
  26. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/gov_favicon.ico +0 -0
  27. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/govuk-crest.svg +0 -0
  28. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/hm-government-logo.png +0 -0
  29. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/mhclg_coat_of_arms.png +0 -0
  30. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/mhclg_white_no_background.png +0 -0
  31. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/oflog/MedianAbsolute.png +0 -0
  32. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/oflog/how_to_1_selecting_data.png +0 -0
  33. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/oflog/how_to_2_viewing_tabs.png +0 -0
  34. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/oflog/how_to_3_viewing_charts.png +0 -0
  35. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/oflog/how_to_4_viewing_trends.png +0 -0
  36. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/images/oflog/how_to_5_viewing_tables.png +0 -0
  37. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/mobile-nav.js +0 -0
  38. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/topojson/usa_110m.json +0 -0
  39. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/assets/topojson/world_110m.json +0 -0
  40. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/axes.py +0 -0
  41. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/colours.py +0 -0
  42. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/__init__.py +0 -0
  43. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/__init__.py +0 -0
  44. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/apply_and_reset_filters_buttons.py +0 -0
  45. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/banners.py +0 -0
  46. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/card.py +0 -0
  47. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/card_full_width.py +0 -0
  48. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/collapsible_panel.py +0 -0
  49. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/comparison_la_filter_button.py +0 -0
  50. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/context_banner.py +0 -0
  51. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/create_download_chart_button.py +0 -0
  52. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/create_download_data_button.py +0 -0
  53. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/dashboard_container.py +0 -0
  54. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/details.py +0 -0
  55. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/download_button.py +0 -0
  56. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/filter_panel.py +0 -0
  57. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/footer.py +0 -0
  58. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/graph.py +0 -0
  59. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/header.py +0 -0
  60. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/heading.py +0 -0
  61. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/home_page_link_button.py +0 -0
  62. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/html_list.py +0 -0
  63. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/key_value_pair.py +0 -0
  64. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/main_content.py +0 -0
  65. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/navbar.py +0 -0
  66. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/no_data_message.py +0 -0
  67. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/notification_banner.py +0 -0
  68. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/paragraph.py +0 -0
  69. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/phase_banner.py +0 -0
  70. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/row_component.py +0 -0
  71. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/side_navbar.py +0 -0
  72. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/table.py +0 -0
  73. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/tooltip.py +0 -0
  74. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/tooltip_title.py +0 -0
  75. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/visualisation_commentary.py +0 -0
  76. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/visualisation_title.py +0 -0
  77. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/dash/warning_text.py +0 -0
  78. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/helpers/__init__.py +0 -0
  79. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/helpers/display_chart_or_table_with_header.py +0 -0
  80. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/helpers/generate_dash_graph_from_figure.py +0 -0
  81. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/helpers/update_layout_bgcolor_margin.py +0 -0
  82. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/plotly/__init__.py +0 -0
  83. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/plotly/captioned_figure.py +0 -0
  84. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/plotly/choropleth_map.py +0 -0
  85. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/components/plotly/enums.py +0 -0
  86. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/figures/__init__.py +0 -0
  87. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/figures/chart_data.py +0 -0
  88. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/figures/enums/__init__.py +0 -0
  89. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/figures/enums/dash_patterns.py +0 -0
  90. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/figures/line_chart.py +0 -0
  91. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/figures/styles/__init__.py +0 -0
  92. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/figures/styles/line_style.py +0 -0
  93. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/formatting/__init__.py +0 -0
  94. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/formatting/human_readable.py +0 -0
  95. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/formatting/round_and_add_prefix_and_suffix.py +0 -0
  96. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/formatting/rounding.py +0 -0
  97. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/__init__.py +0 -0
  98. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/dap/__init__.py +0 -0
  99. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/dap/dap_deployment.py +0 -0
  100. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/dap/get_dataframe_from_cds.py +0 -0
  101. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/datetime_functions/__init__.py +0 -0
  102. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/datetime_functions/datetime_functions.py +0 -0
  103. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/enable_basic_auth.py +0 -0
  104. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/http_headers.py +0 -0
  105. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/lib/logging.py +0 -0
  106. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/symbols.py +0 -0
  107. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/template.html +0 -0
  108. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards/template.py +0 -0
  109. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards.egg-info/SOURCES.txt +0 -0
  110. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards.egg-info/dependency_links.txt +0 -0
  111. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards.egg-info/requires.txt +0 -0
  112. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/gov_uk_dashboards.egg-info/top_level.txt +0 -0
  113. {gov_uk_dashboards-16.0.0 → gov_uk_dashboards-16.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gov_uk_dashboards
3
- Version: 16.0.0
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
@@ -20,7 +20,7 @@ def get_legend_configuration(itemclick=True, itemdoubleclick=True):
20
20
  "y": -0.22,
21
21
  "yanchor": "top",
22
22
  "traceorder": "normal",
23
- "orientation": "v",
23
+ "orientation": "h",
24
24
  "font": {"size": CHART_LABEL_FONT_SIZE},
25
25
  "itemclick": "toggle" if itemclick else False,
26
26
  "itemdoubleclick": "toggle" if itemdoubleclick else False,
@@ -13,6 +13,7 @@ from gov_uk_dashboards.constants import (
13
13
  DATE_VALID,
14
14
  FINANCIAL_YEAR_ENDING,
15
15
  HOVER_TEXT_HEADERS,
16
+ LEGEND_SPACING,
16
17
  MAIN_TITLE,
17
18
  MEASURE,
18
19
  SUBTITLE,
@@ -157,7 +158,7 @@ class StackedBarChart:
157
158
  customdata=self._get_custom_data(self.line_trace_name, df),
158
159
  mode="lines",
159
160
  line={"color": colour, "width": 3},
160
- name=self.line_trace_name,
161
+ name=self.line_trace_name + LEGEND_SPACING,
161
162
  hovertemplate=self._get_hover_template(self.line_trace_name),
162
163
  legendrank=99999, # a high number to ensure it is bottom of the legend
163
164
  )
@@ -214,7 +215,7 @@ class StackedBarChart:
214
215
  return go.Bar(
215
216
  x=df[self.x_axis_column],
216
217
  y=df[self.y_axis_column],
217
- name=trace_name,
218
+ name=trace_name + LEGEND_SPACING,
218
219
  hovertemplate=[
219
220
  self._get_hover_template(trace_name) for i in range(df.shape[0])
220
221
  ],
@@ -13,6 +13,7 @@ from gov_uk_dashboards.constants import (
13
13
  CUSTOM_DATA,
14
14
  DATE_VALID,
15
15
  HOVER_TEXT_HEADERS,
16
+ LEGEND_SPACING,
16
17
  MAIN_TITLE,
17
18
  REMOVE_INITIAL_MARKER,
18
19
  SUBTITLE,
@@ -76,6 +77,7 @@ class TimeSeriesChart:
76
77
  download_data_button_id: Optional[str] = None,
77
78
  number_of_traces_colour_shift_dict: Optional[dict] = None,
78
79
  additional_line: Optional[dict] = None,
80
+ hover_distance: Optional[int] = 1,
79
81
  ):
80
82
  self.title_data = title_data
81
83
  self.y_axis_column = y_column
@@ -103,6 +105,7 @@ class TimeSeriesChart:
103
105
  self.markers = ["square", "diamond", "circle", "triangle-up"]
104
106
  self.number_of_traces_colour_shift_dict = number_of_traces_colour_shift_dict
105
107
  self.additional_line = additional_line
108
+ self.hover_distance = hover_distance
106
109
  self.colour_list = self._get_colour_list()
107
110
  self.fig = self.create_time_series_chart()
108
111
 
@@ -153,6 +156,7 @@ class TimeSeriesChart:
153
156
  line={"color": line_color},
154
157
  hoverinfo="skip", # 👈 This line disables hover for this trace
155
158
  showlegend=False, # Optional: hide it from legend too
159
+ legendgroup=self.additional_line["legend_group"],
156
160
  )
157
161
  fig.add_trace(trace_connector)
158
162
  # pylint: disable=unused-variable
@@ -170,12 +174,14 @@ class TimeSeriesChart:
170
174
  marker_sizes = [0] + [12] * (len(df.with_row_count()) - 1)
171
175
  else:
172
176
  marker_sizes = [12] * (len(df.with_row_count()))
177
+ legendgroup = self._get_legend_group(df)
173
178
  fig.add_trace(
174
179
  self.create_time_series_trace(
175
180
  df.sort(self.x_axis_column),
176
181
  trace_name,
177
182
  line_style={"dash": "solid", "color": colour},
178
183
  marker={"symbol": marker, "size": marker_sizes, "opacity": 1},
184
+ legendgroup=legendgroup,
179
185
  ),
180
186
  )
181
187
 
@@ -217,6 +223,7 @@ class TimeSeriesChart:
217
223
  ]
218
224
 
219
225
  hover_text_full = hover_text + hover_text[::-1]
226
+ legendgroup = self._get_legend_group(fill_df)
220
227
  fig.add_trace(
221
228
  go.Scatter(
222
229
  x=x_series + x_series[::-1],
@@ -226,9 +233,10 @@ class TimeSeriesChart:
226
233
  AFAccessibleColours.TURQUOISE.value, alpha=0.2
227
234
  ),
228
235
  line={"color": "rgba(255,255,255,0)"},
229
- name=self.filled_traces_dict["name"],
236
+ name=self.filled_traces_dict["name"] + LEGEND_SPACING,
230
237
  hovertemplate=hover_text_full,
231
238
  hoveron="points",
239
+ legendgroup=legendgroup,
232
240
  )
233
241
  )
234
242
  self._format_x_axis(fig)
@@ -281,10 +289,10 @@ class TimeSeriesChart:
281
289
  xref="x domain",
282
290
  yref="y domain",
283
291
  x=1,
284
- y=-0.25,
292
+ y=-0.2,
285
293
  text=self.x_axis_title,
286
294
  showarrow=False,
287
- font={"size": CHART_LABEL_FONT_SIZE},
295
+ font={"size": 16},
288
296
  )
289
297
 
290
298
  fig.update_layout(
@@ -292,10 +300,18 @@ class TimeSeriesChart:
292
300
  font={"size": CHART_LABEL_FONT_SIZE},
293
301
  yaxis_tickformat=",",
294
302
  hovermode="x unified" if self.x_unified_hovermode is True else "closest",
295
- hoverdistance=1, # Increase distance to simulate hover 'always on'
303
+ hoverdistance=self.hover_distance, # Increase distance to simulate hover 'always on'
296
304
  )
297
305
  return fig
298
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
+
299
315
  # pylint: disable=duplicate-code
300
316
  def _format_x_axis(self, fig):
301
317
  tick_text, tick_values, range_x = self._get_x_axis_content()
@@ -314,6 +330,7 @@ class TimeSeriesChart:
314
330
  trace_name: str,
315
331
  line_style: dict[str, str],
316
332
  marker: dict[str, str],
333
+ legendgroup: str,
317
334
  ):
318
335
  """Creates a trace for the plot.
319
336
 
@@ -323,12 +340,13 @@ class TimeSeriesChart:
323
340
  trace_name (str): Name of trace.
324
341
  line_style (dict[str, str]): Properties for line_style parameter.
325
342
  marker (dict[str,str]): Properties for marker parameter.
343
+ legendgroup (str): Name to group by in legend,
326
344
  """
327
345
  return go.Scatter(
328
346
  x=df[self.x_axis_column],
329
347
  y=df[self.y_axis_column],
330
348
  line=line_style,
331
- name=self._get_trace_name(trace_name),
349
+ name=self._get_trace_name(trace_name) + LEGEND_SPACING,
332
350
  hovertemplate=self._get_hover_template(df, trace_name),
333
351
  customdata=self._get_custom_data(df, trace_name),
334
352
  marker=marker,
@@ -336,6 +354,7 @@ class TimeSeriesChart:
336
354
  showlegend=(
337
355
  trace_name in self.legend_dict if self.legend_dict is not None else True
338
356
  ),
357
+ legendgroup=legendgroup,
339
358
  )
340
359
 
341
360
  def _get_hover_template(self, df, trace_name):
@@ -16,3 +16,5 @@ YEAR = "Year"
16
16
 
17
17
  UNIT_SIZE = "Unit size"
18
18
  DEFAULT_COLOURSCALE = "tealgrn"
19
+
20
+ LEGEND_SPACING = "\u00A0" * 5
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gov_uk_dashboards
3
- Version: 16.0.0
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
@@ -10,7 +10,7 @@ setup(
10
10
  author="Department for Levelling Up, Housing and Communities",
11
11
  description="Provides access to functionality common to creating a data dashboard.",
12
12
  name="gov_uk_dashboards",
13
- version="16.0.0",
13
+ version="16.2.0",
14
14
  long_description=long_description,
15
15
  long_description_content_type="text/markdown",
16
16
  packages=find_packages(),