Files
HighCostDrugsDemo/dash_app/components/chart_card.py
T

89 lines
3.2 KiB
Python

"""Chart card component — header, tabs, and dcc.Graph for icicle chart."""
from dash import html, dcc
def make_chart_card():
"""Return a chart card matching 01_nhs_classic.html structure.
Contains:
- Header with title and dynamic subtitle (hierarchy label)
- Tab row (Icicle active, Sankey and Timeline as disabled placeholders)
- dcc.Loading wrapper around dcc.Graph for loading spinner
"""
return html.Section(
className="chart-card",
**{"aria-label": "Patient pathway chart"},
children=[
# Card header
html.Div(
className="chart-card__header",
children=[
html.Div(
children=[
html.Div(
"Patient Pathway Visualization",
className="chart-card__title",
),
html.Div(
"Trust \u2192 Directorate \u2192 Drug \u2192 Patient Pathway",
className="chart-card__subtitle",
id="chart-subtitle",
),
]
),
],
),
# Tab row
html.Div(
className="chart-card__tabs",
role="tablist",
children=[
html.Button(
"Icicle",
className="chart-tab chart-tab--active",
role="tab",
**{"aria-selected": "true"},
),
html.Button(
"Sankey",
className="chart-tab",
role="tab",
disabled=True,
**{"aria-selected": "false"},
),
html.Button(
"Timeline",
className="chart-tab",
role="tab",
disabled=True,
**{"aria-selected": "false"},
),
],
),
# Chart area with loading spinner
dcc.Loading(
type="circle",
color="#005EB8",
children=[
html.Div(
id="chart-container",
children=[
dcc.Graph(
id="pathway-chart",
style={"minHeight": "500px", "flex": "1"},
config={
"displayModeBar": True,
"displaylogo": False,
"modeBarButtonsToRemove": [
"lasso2d",
"select2d",
],
},
),
],
),
],
),
],
)