gov-uk-dashboards 14.0.0__py3-none-any.whl → 15.0.1__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.
@@ -172,6 +172,7 @@ class TimeSeriesChart:
172
172
  ),
173
173
  )
174
174
  )
175
+ self._format_x_axis(fig)
175
176
 
176
177
  # if self.average_increment_for_average_trace is not None:
177
178
  # trace_name = LINEAR_TRAJECTORY
@@ -192,7 +193,6 @@ class TimeSeriesChart:
192
193
  # hoverinfo="skip",
193
194
  # )
194
195
  # )
195
-
196
196
  if self.verticle_line_x_value_and_name is not None:
197
197
 
198
198
  fig.add_vline(
@@ -202,7 +202,7 @@ class TimeSeriesChart:
202
202
  line_color="#b3b3b3",
203
203
  )
204
204
  fig.add_annotation(
205
- x=self.verticle_line_x_value_and_name,
205
+ x=self.verticle_line_x_value_and_name[0],
206
206
  yref="paper",
207
207
  y=0.9,
208
208
  text=self.verticle_line_x_value_and_name[1],
@@ -246,8 +246,6 @@ class TimeSeriesChart:
246
246
  range=range_x,
247
247
  )
248
248
 
249
- return tick_values
250
-
251
249
  def create_time_series_trace(
252
250
  self,
253
251
  df: pl.DataFrame,
@@ -268,7 +266,6 @@ class TimeSeriesChart:
268
266
  hover_label (dict[str,str]): Properties for hoverlabel parameter.
269
267
  marker (dict[str,str]): Properties for marker parameter.
270
268
  """
271
-
272
269
  return go.Scatter(
273
270
  x=df[self.x_axis_column],
274
271
  y=df[self.y_axis_column],
@@ -317,6 +314,7 @@ class TimeSeriesChart:
317
314
  ][HOVER_TEXT_HEADERS]
318
315
  )
319
316
  # pylint: disable=duplicate-code
317
+
320
318
  return (
321
319
  f"{trace_name}<br>"
322
320
  f"{hover_text_headers[0]}"
@@ -333,7 +331,6 @@ class TimeSeriesChart:
333
331
  and trace_name
334
332
  in self.hover_data_for_traces_with_different_hover_for_last_point
335
333
  ):
336
-
337
334
  customdata = [
338
335
  (
339
336
  [df[col][i] for col in self.hover_data[trace_name][CUSTOM_DATA]]
@@ -369,16 +366,17 @@ class TimeSeriesChart:
369
366
  .dt.year()
370
367
  .alias(YEAR)
371
368
  )
372
-
369
+ date_list = df_with_year_column[self.x_axis_column].unique().to_list()
370
+ min_date_string = min(date_list)
371
+ max_date_string = max(date_list)
372
+ min_datetime = datetime.strptime(min_date_string, "%Y-%m-%d")
373
+ max_datetime = datetime.strptime(max_date_string, "%Y-%m-%d")
373
374
  year_list = df_with_year_column[YEAR].unique().to_list()
374
-
375
- tick_text = [min(year_list) - 1] + year_list + [max(year_list) + 1]
376
-
375
+ tick_text = list(range(min(year_list) - 1, max(year_list) + 2))
377
376
  tick_values = [date(year, 1, 1) for year in tick_text]
378
-
379
377
  range_x = [
380
- tick_values[0] + relativedelta(months=6),
381
- tick_values[-1] + relativedelta(months=6),
378
+ min_datetime - relativedelta(months=6),
379
+ max_datetime + relativedelta(months=6),
382
380
  ]
383
381
 
384
382
  elif self.xaxis_tick_text_format == XAxisFormat.MONTH_YEAR.value:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gov_uk_dashboards
3
- Version: 14.0.0
3
+ Version: 15.0.1
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
@@ -78,7 +78,7 @@ gov_uk_dashboards/components/plotly/captioned_figure.py,sha256=T0sbtGTiJ79FXxVdP
78
78
  gov_uk_dashboards/components/plotly/choropleth_map.py,sha256=kX44qgxAL9i3w0bT7N2274iBcH5RiyeWF_lVWV1hju0,9292
79
79
  gov_uk_dashboards/components/plotly/enums.py,sha256=0QnVyXwnBQRqP3p8YIgPsvGLPu-wClBj9F_722GDfYU,794
80
80
  gov_uk_dashboards/components/plotly/stacked_barchart.py,sha256=y2XOf96tMfy5ythPb5RzqW5qGc2sKU3W508UbWO2iC0,12175
81
- gov_uk_dashboards/components/plotly/time_series_chart.py,sha256=hZ99q1PeyPKKoFvXsUPQfbpjMamKLGy7iJZ2rjJOmDI,17862
81
+ gov_uk_dashboards/components/plotly/time_series_chart.py,sha256=oOxGjCjoKclLc5o9qGc6vMtb1LXWZ2WbdZzQ31NLZ9E,18176
82
82
  gov_uk_dashboards/figures/__init__.py,sha256=_snQeNlM81nNKERl4gg9ScH2HYbtwaBjl8yQonccx34,712
83
83
  gov_uk_dashboards/figures/chart_data.py,sha256=fEsNkQFzXKIQ0h7aLBWq3J1qAxHbxvJeKU23JrVodVc,757
84
84
  gov_uk_dashboards/figures/line_chart.py,sha256=rEB51_z9cPl7BcT94iA6ZsZXzecnVCnGpQWW_9SNGUY,2813
@@ -99,8 +99,8 @@ gov_uk_dashboards/lib/dap/dap_deployment.py,sha256=ZXixeOAtRNjMsPdGKLwwLNamlo0mi
99
99
  gov_uk_dashboards/lib/dap/get_dataframe_from_cds.py,sha256=OiusRCgYnkBjK_GZgYLGzNrxOGizYt8CgThiWRCVKK0,3921
100
100
  gov_uk_dashboards/lib/datetime_functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
101
  gov_uk_dashboards/lib/datetime_functions/datetime_functions.py,sha256=BQgr8I_vFNYwLi-fE4YC6jZ5PpbPea2rnD_2a_lw0YE,12209
102
- gov_uk_dashboards-14.0.0.dist-info/licenses/LICENSE,sha256=GDiD7Y2Gx7JucPV1JfVySJeah-qiSyBPdpJ6RHCEHTc,1126
103
- gov_uk_dashboards-14.0.0.dist-info/METADATA,sha256=qvuAm5o4ZXqvgFBrzuYmtkzWH9AHsG0PZhuT0Demiu0,5917
104
- gov_uk_dashboards-14.0.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
105
- gov_uk_dashboards-14.0.0.dist-info/top_level.txt,sha256=gPaN1P3-H3Rgi2me6tt-fX_cxo19CZfA4PjlZPjGRpo,18
106
- gov_uk_dashboards-14.0.0.dist-info/RECORD,,
102
+ gov_uk_dashboards-15.0.1.dist-info/licenses/LICENSE,sha256=GDiD7Y2Gx7JucPV1JfVySJeah-qiSyBPdpJ6RHCEHTc,1126
103
+ gov_uk_dashboards-15.0.1.dist-info/METADATA,sha256=SMJrlFrbMV_PvdI6pxCnzRwNj35EXukgfUj4CEXTAY8,5917
104
+ gov_uk_dashboards-15.0.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
105
+ gov_uk_dashboards-15.0.1.dist-info/top_level.txt,sha256=gPaN1P3-H3Rgi2me6tt-fX_cxo19CZfA4PjlZPjGRpo,18
106
+ gov_uk_dashboards-15.0.1.dist-info/RECORD,,