gov-uk-dashboards 15.0.2__py3-none-any.whl → 15.0.3__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.
@@ -9,6 +9,7 @@ class XAxisFormat(Enum):
9
9
 
10
10
  YEAR = "year"
11
11
  MONTH_YEAR = "month_year"
12
+ MONTH_YEAR_MONTHLY_DATA = "month_year_monthly_data"
12
13
  FINANCIAL_QUARTER = "financial_quarter"
13
14
 
14
15
 
@@ -397,7 +397,6 @@ class TimeSeriesChart:
397
397
  tick_text_length = len(tick_text)
398
398
  total_tick_points = int((tick_text_length / 5) * 7)
399
399
  additional_tick_points = total_tick_points - tick_text_length
400
-
401
400
  last_current_tick_text = datetime.strptime(tick_text[-1], "%b %Y")
402
401
 
403
402
  for x in range(additional_tick_points):
@@ -417,6 +416,34 @@ class TimeSeriesChart:
417
416
  tick_values[-1] + relativedelta(months=1),
418
417
  ]
419
418
  tick_text = replace_jun_jul_month_abbreviations(tick_text)
419
+
420
+ elif self.xaxis_tick_text_format == XAxisFormat.MONTH_YEAR_MONTHLY_DATA.value:
421
+ df = self.filtered_df.with_columns(
422
+ pl.col(self.x_axis_column)
423
+ .str.strptime(pl.Date, "%Y-%m-%d")
424
+ .alias(self.x_axis_column)
425
+ ).sort(self.x_axis_column)
426
+
427
+ start_datetime = datetime(2024, 7, 1).date()
428
+ latest_datetime = df[self.x_axis_column].max()
429
+ extra_datetime = latest_datetime + relativedelta(months=1)
430
+
431
+ tick_text = []
432
+ current = start_datetime
433
+ while current <= extra_datetime:
434
+ tick_text.append(current.strftime("%b %Y"))
435
+ current += relativedelta(months=1)
436
+
437
+ tick_values = [
438
+ datetime.strptime(month_year, "%b %Y").replace(day=1)
439
+ for month_year in tick_text
440
+ ]
441
+
442
+ range_x = [
443
+ tick_values[0],
444
+ tick_values[-1],
445
+ ]
446
+ tick_text = replace_jun_jul_month_abbreviations(tick_text)
420
447
  elif self.xaxis_tick_text_format == XAxisFormat.FINANCIAL_QUARTER.value:
421
448
  tick_values = [1, 2, 3, 4]
422
449
  tick_text = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gov_uk_dashboards
3
- Version: 15.0.2
3
+ Version: 15.0.3
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
@@ -76,9 +76,9 @@ gov_uk_dashboards/components/helpers/update_layout_bgcolor_margin.py,sha256=i7Nw
76
76
  gov_uk_dashboards/components/plotly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  gov_uk_dashboards/components/plotly/captioned_figure.py,sha256=T0sbtGTiJ79FXxVdPb__hqISuyTc3Dl11cKhgcuW-5U,2804
78
78
  gov_uk_dashboards/components/plotly/choropleth_map.py,sha256=U9RmS3MZGloQAt9HoSYh3Xad205DDfZOjz91ZD_ydbI,9849
79
- gov_uk_dashboards/components/plotly/enums.py,sha256=0QnVyXwnBQRqP3p8YIgPsvGLPu-wClBj9F_722GDfYU,794
79
+ gov_uk_dashboards/components/plotly/enums.py,sha256=ebHiFQljA7O4HJxKoslqlNXcAjUZi1askpTSwxKEcYQ,850
80
80
  gov_uk_dashboards/components/plotly/stacked_barchart.py,sha256=y2XOf96tMfy5ythPb5RzqW5qGc2sKU3W508UbWO2iC0,12175
81
- gov_uk_dashboards/components/plotly/time_series_chart.py,sha256=oOxGjCjoKclLc5o9qGc6vMtb1LXWZ2WbdZzQ31NLZ9E,18176
81
+ gov_uk_dashboards/components/plotly/time_series_chart.py,sha256=whdOe4xPfpmWazPrOZDF38dfkhGWpZ7dqO3RQPIun3o,19228
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-15.0.2.dist-info/licenses/LICENSE,sha256=GDiD7Y2Gx7JucPV1JfVySJeah-qiSyBPdpJ6RHCEHTc,1126
103
- gov_uk_dashboards-15.0.2.dist-info/METADATA,sha256=vnBnaJwv-t8MIGRQvARA2SNDOXHlgMQSqtTUEK77fdY,5917
104
- gov_uk_dashboards-15.0.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
105
- gov_uk_dashboards-15.0.2.dist-info/top_level.txt,sha256=gPaN1P3-H3Rgi2me6tt-fX_cxo19CZfA4PjlZPjGRpo,18
106
- gov_uk_dashboards-15.0.2.dist-info/RECORD,,
102
+ gov_uk_dashboards-15.0.3.dist-info/licenses/LICENSE,sha256=GDiD7Y2Gx7JucPV1JfVySJeah-qiSyBPdpJ6RHCEHTc,1126
103
+ gov_uk_dashboards-15.0.3.dist-info/METADATA,sha256=zVTYb10D5dl_s0qkhzZ3IPgM41B6NegcQ6tMSBPRsgo,5917
104
+ gov_uk_dashboards-15.0.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
105
+ gov_uk_dashboards-15.0.3.dist-info/top_level.txt,sha256=gPaN1P3-H3Rgi2me6tt-fX_cxo19CZfA4PjlZPjGRpo,18
106
+ gov_uk_dashboards-15.0.3.dist-info/RECORD,,