gov-uk-dashboards 13.5.2__tar.gz → 15.0.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.
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards.egg-info → gov_uk_dashboards-15.0.0}/PKG-INFO +1 -1
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/components/__init__.py +1 -1
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/__init__.py +2 -2
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/create_download_chart_button.py +1 -1
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/create_download_data_button.py +1 -1
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/filter_panel.py +1 -1
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/table.py +2 -2
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/helpers}/display_chart_or_table_with_header.py +4 -4
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/lib → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/helpers}/plotting_helper_functions.py +17 -0
- gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/plotly/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/components/plotly/choropleth_map.py +1 -1
- gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/plotly/enums.py +34 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/components/plotly/stacked_barchart.py +12 -36
- gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/plotly/time_series_chart.py +477 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/constants.py +5 -0
- gov_uk_dashboards-15.0.0/gov_uk_dashboards/lib/__init__.py +0 -0
- gov_uk_dashboards-15.0.0/gov_uk_dashboards/lib/datetime_functions/__init__.py +0 -0
- gov_uk_dashboards-15.0.0/gov_uk_dashboards/lib/datetime_functions/datetime_functions.py +345 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0/gov_uk_dashboards.egg-info}/PKG-INFO +1 -1
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards.egg-info/SOURCES.txt +44 -38
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/setup.py +1 -1
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/LICENSE +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/MANIFEST.in +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/README.md +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/attach-event-to-dash.js +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/dashboard.css +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/fonts/bold-affa96571d-v2.woff +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/fonts/light-f591b13f7d-v2.woff +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/get_assets_folder.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/govuk-frontend-3.14.0.min.js +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/DLUHC_WHITE_Master_AW_sm.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/MHCLG-favicon.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/MHCLG_favicon.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/dcms_coatofarms.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/dluhc_favicon.ico +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/gov_favicon.ico +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/govuk-crest.svg +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/hm-government-logo.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/mhclg_coat_of_arms.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/mhclg_white_no_background.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/oflog/MedianAbsolute.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/oflog/how_to_1_selecting_data.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/oflog/how_to_2_viewing_tabs.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/oflog/how_to_3_viewing_charts.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/oflog/how_to_4_viewing_trends.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/images/oflog/how_to_5_viewing_tables.png +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/mobile-nav.js +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/topojson/usa_110m.json +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/assets/topojson/world_110m.json +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/axes.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/colours.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/apply_and_reset_filters_buttons.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/banners.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/card.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/card_full_width.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/collapsible_panel.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/comparison_la_filter_button.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/context_banner.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/dashboard_container.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/details.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/download_button.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/footer.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/graph.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/header.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/heading.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/html_list.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/key_value_pair.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/main_content.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/navbar.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/no_data_message.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/notification_banner.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/paragraph.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/phase_banner.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/row_component.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/side_navbar.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/tooltip.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/tooltip_title.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/visualisation_commentary.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/visualisation_title.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/dash}/warning_text.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/lib → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/helpers}/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/components/plotly → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/helpers}/generate_dash_graph_from_figure.py +0 -0
- {gov_uk_dashboards-13.5.2/gov_uk_dashboards/lib → gov_uk_dashboards-15.0.0/gov_uk_dashboards/components/helpers}/update_layout_bgcolor_margin.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/components/plotly/captioned_figure.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/figures/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/figures/chart_data.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/figures/enums/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/figures/enums/dash_patterns.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/figures/line_chart.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/figures/styles/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/figures/styles/line_style.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/formatting/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/formatting/human_readable.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/formatting/round_and_add_prefix_and_suffix.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/formatting/rounding.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/lib/dap/__init__.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/lib/dap/dap_deployment.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/lib/dap/get_dataframe_from_cds.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/lib/enable_basic_auth.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/lib/http_headers.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/lib/logging.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/symbols.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/template.html +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards/template.py +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards.egg-info/dependency_links.txt +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards.egg-info/requires.txt +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/gov_uk_dashboards.egg-info/top_level.txt +0 -0
- {gov_uk_dashboards-13.5.2 → gov_uk_dashboards-15.0.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: gov_uk_dashboards
|
3
|
-
Version:
|
3
|
+
Version: 15.0.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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Module containing
|
1
|
+
"""Module containing Dash components for building GOV.UK Design System dashboards.
|
2
2
|
|
3
3
|
See: https://design-system.service.gov.uk/components/
|
4
4
|
|
@@ -63,7 +63,7 @@ the right
|
|
63
63
|
"""
|
64
64
|
|
65
65
|
from .banners import message_banner
|
66
|
-
from .captioned_figure import captioned_figure
|
66
|
+
from ..plotly.captioned_figure import captioned_figure
|
67
67
|
from .card import card, empty_card
|
68
68
|
from .card_full_width import card_full_width
|
69
69
|
from .apply_and_reset_filters_buttons import apply_and_reset_filters_buttons
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"""create_download_chart_button"""
|
2
2
|
|
3
3
|
from dash import html
|
4
|
-
from gov_uk_dashboards.components.
|
4
|
+
from gov_uk_dashboards.components.dash import download_button_with_icon
|
5
5
|
|
6
6
|
|
7
7
|
def create_download_chart_button(button_id_name: str) -> html.Div:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"""create_download_data_button"""
|
2
2
|
|
3
3
|
from dash import html
|
4
|
-
from gov_uk_dashboards.components.
|
4
|
+
from gov_uk_dashboards.components.dash import download_button_with_icon
|
5
5
|
|
6
6
|
|
7
7
|
def create_download_data_button(button_id_name: str) -> html.Div:
|
@@ -2,7 +2,7 @@
|
|
2
2
|
from typing import Optional
|
3
3
|
from dash import html
|
4
4
|
|
5
|
-
from gov_uk_dashboards.components.
|
5
|
+
from gov_uk_dashboards.components.dash.heading import heading2
|
6
6
|
from .collapsible_panel import collapsible_panel
|
7
7
|
from .row_component import row_component
|
8
8
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
from typing import Optional
|
3
3
|
from pandas import DataFrame
|
4
4
|
from dash import html, dcc
|
5
|
-
from gov_uk_dashboards.components.
|
6
|
-
from gov_uk_dashboards.components.
|
5
|
+
from gov_uk_dashboards.components.dash.card import card
|
6
|
+
from gov_uk_dashboards.components.dash.paragraph import paragraph
|
7
7
|
|
8
8
|
# from gov_uk_dashboards.components.plotly.row_component import row_component
|
9
9
|
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
from dash import html
|
4
4
|
from dash.development.base_component import Component
|
5
|
-
|
5
|
+
|
6
|
+
from gov_uk_dashboards.components.dash.create_download_chart_button import (
|
6
7
|
create_download_chart_button,
|
7
8
|
)
|
8
|
-
from gov_uk_dashboards.components.create_download_data_button import (
|
9
|
+
from gov_uk_dashboards.components.dash.create_download_data_button import (
|
9
10
|
create_download_data_button,
|
10
11
|
)
|
11
|
-
|
12
|
-
from gov_uk_dashboards.components.plotly.heading import HeadingSizes
|
12
|
+
from gov_uk_dashboards.components.dash.heading import HeadingSizes
|
13
13
|
|
14
14
|
|
15
15
|
def display_chart_or_table_with_header(
|
@@ -27,3 +27,20 @@ def get_legend_configuration(itemclick=True, itemdoubleclick=True):
|
|
27
27
|
"itemclick": "toggle" if itemclick else False,
|
28
28
|
"itemdoubleclick": "toggle" if itemdoubleclick else False,
|
29
29
|
}
|
30
|
+
|
31
|
+
|
32
|
+
def get_rgba_from_hex_colour_and_alpha(hex_code: str, alpha: float = 1.0) -> str:
|
33
|
+
"""Get the rgba string corresponding to a hex-code colour and its alpha (opacity)
|
34
|
+
|
35
|
+
Args:
|
36
|
+
hex_code (str): hex code for converting (with #), e.g. "#00FF00"
|
37
|
+
alpha (float, optional): Desired transparency from 0 to 1. Defaults to 1.0.
|
38
|
+
|
39
|
+
Returns:
|
40
|
+
str: rgba string
|
41
|
+
"""
|
42
|
+
if hex_code[0] != "#" or len(hex_code) != 7:
|
43
|
+
raise ValueError
|
44
|
+
rgb_colour = tuple(int(hex_code[i : i + 2], 16) for i in (1, 3, 5))
|
45
|
+
|
46
|
+
return f"rgba{rgb_colour + (alpha,)}"
|
File without changes
|
@@ -7,7 +7,7 @@ from dash import dcc
|
|
7
7
|
from gov_uk_dashboards.constants import DEFAULT_COLOURSCALE
|
8
8
|
|
9
9
|
from gov_uk_dashboards import colours
|
10
|
-
from gov_uk_dashboards.components.display_chart_or_table_with_header import (
|
10
|
+
from gov_uk_dashboards.components.helpers.display_chart_or_table_with_header import (
|
11
11
|
display_chart_or_table_with_header,
|
12
12
|
)
|
13
13
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"""Classes to be used for defined enums and type structures"""
|
2
|
+
|
3
|
+
from enum import Enum
|
4
|
+
from typing import TypedDict
|
5
|
+
|
6
|
+
|
7
|
+
class XAxisFormat(Enum):
|
8
|
+
"""Enum for date format on x axis"""
|
9
|
+
|
10
|
+
YEAR = "year"
|
11
|
+
MONTH_YEAR = "month_year"
|
12
|
+
FINANCIAL_QUARTER = "financial_quarter"
|
13
|
+
|
14
|
+
|
15
|
+
class TitleDataStructure(TypedDict):
|
16
|
+
"""A TypedDict representing the structure of title_data"""
|
17
|
+
|
18
|
+
MAIN_TITLE: str
|
19
|
+
SUBTITLE: str
|
20
|
+
|
21
|
+
|
22
|
+
class HoverDataStructure(TypedDict):
|
23
|
+
"""A TypedDict representing the structure of hover_data"""
|
24
|
+
|
25
|
+
CUSTOM_DATA: list[str]
|
26
|
+
HOVER_TEXT_HEADERS: list[str]
|
27
|
+
|
28
|
+
|
29
|
+
class HoverDataByTrace(TypedDict):
|
30
|
+
"""A TypedDict representing hover_data organized by tracename"""
|
31
|
+
|
32
|
+
tracename: dict[
|
33
|
+
str, HoverDataStructure
|
34
|
+
] # Each tracename maps to a HoverDataStructure
|
@@ -1,8 +1,7 @@
|
|
1
1
|
"""stacked_barchart function"""
|
2
2
|
|
3
|
-
from enum import Enum
|
4
3
|
import math
|
5
|
-
from typing import Optional
|
4
|
+
from typing import Optional
|
6
5
|
from dash import html
|
7
6
|
import polars as pl
|
8
7
|
|
@@ -20,50 +19,27 @@ from gov_uk_dashboards.constants import (
|
|
20
19
|
VALUE,
|
21
20
|
)
|
22
21
|
from gov_uk_dashboards.colours import AFAccessibleColours
|
23
|
-
from gov_uk_dashboards.components.display_chart_or_table_with_header import (
|
22
|
+
from gov_uk_dashboards.components.helpers.display_chart_or_table_with_header import (
|
24
23
|
display_chart_or_table_with_header,
|
25
24
|
)
|
26
|
-
from gov_uk_dashboards.components.
|
25
|
+
from gov_uk_dashboards.components.helpers.generate_dash_graph_from_figure import (
|
27
26
|
generate_dash_graph_from_figure,
|
28
27
|
)
|
29
|
-
from gov_uk_dashboards.
|
28
|
+
from gov_uk_dashboards.components.helpers.plotting_helper_functions import (
|
29
|
+
get_legend_configuration,
|
30
|
+
)
|
31
|
+
from gov_uk_dashboards.components.plotly.enums import (
|
32
|
+
HoverDataByTrace,
|
33
|
+
TitleDataStructure,
|
34
|
+
XAxisFormat,
|
35
|
+
)
|
30
36
|
from gov_uk_dashboards.formatting.human_readable import format_as_human_readable
|
31
37
|
|
32
|
-
from gov_uk_dashboards.
|
38
|
+
from gov_uk_dashboards.components.helpers.update_layout_bgcolor_margin import (
|
33
39
|
update_layout_bgcolor_margin,
|
34
40
|
)
|
35
41
|
|
36
42
|
|
37
|
-
class XAxisFormat(Enum):
|
38
|
-
"""Enum for date format on x axis"""
|
39
|
-
|
40
|
-
YEAR = "year"
|
41
|
-
MONTH_YEAR = "month_year"
|
42
|
-
FINANCIAL_QUARTER = "financial_quarter"
|
43
|
-
|
44
|
-
|
45
|
-
class TitleDataStructure(TypedDict):
|
46
|
-
"""A TypedDict representing the structure of title_data"""
|
47
|
-
|
48
|
-
MAIN_TITLE: str
|
49
|
-
SUBTITLE: str
|
50
|
-
|
51
|
-
|
52
|
-
class HoverDataStructure(TypedDict):
|
53
|
-
"""A TypedDict representing the structure of hover_data"""
|
54
|
-
|
55
|
-
CUSTOM_DATA: list[str]
|
56
|
-
HOVER_TEXT_HEADERS: list[str]
|
57
|
-
|
58
|
-
|
59
|
-
class HoverDataByTrace(TypedDict):
|
60
|
-
"""A TypedDict representing hover_data organized by tracename"""
|
61
|
-
|
62
|
-
tracename: dict[
|
63
|
-
str, HoverDataStructure
|
64
|
-
] # Each tracename maps to a HoverDataStructure
|
65
|
-
|
66
|
-
|
67
43
|
class StackedBarChart:
|
68
44
|
"""Class for use in generating stacked bar charts."""
|
69
45
|
|