Skip to content

Commit 588fd8f

Browse files
committed
Fix font and formatting
1 parent c4ad3e8 commit 588fd8f

File tree

4 files changed

+54
-20
lines changed

4 files changed

+54
-20
lines changed

requirements1.txt

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ subgrounds<1.7
1111
werkzeug<2.1.0
1212
circlify==0.14.0
1313
matplotlib==3.5.2
14-
plotly==5.7.0
1514
kaleido==0.2.1
1615
dash==2.14.2
1716

requirements2.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
plotly==5.20.0
12
prefect==2.12.0
23
prefect-aws==0.3.7
34
pyarrow==12.0.0

src/apps/treasury/assets/custom.css

+2-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
/* Set the default font to Poppins regular*/
1515
*{
1616
font-family: 'Poppins', sans-serif;
17+
margin:0;
18+
padding:0;
1719
}
1820

1921
.card_topic{
@@ -49,10 +51,6 @@
4951
height:60px;
5052
}
5153

52-
*{
53-
margin:0;
54-
padding:0;
55-
}
5654
body{
5755
font-family: 'Poppins', sans-serif;
5856
line-height:1.2;

src/apps/treasury/pages/hud.py

+51-15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pandas as pd
88
import plotly.graph_objects as go
99
import plotly.express as px
10+
import plotly
1011

1112
from src.apps.treasury.util.constants import BCT_ERC20_CONTRACT
1213
from src.apps.treasury.data.protocol_metrics import \
@@ -22,24 +23,24 @@
2223
# last_metric_df = sg.query_df([last_metric.marketCap, last_metric.treasuryMarketValue, ...])
2324

2425
# Market Cap indicator
25-
mc_fig = go.Figure(
26+
metric_fig = go.Figure(
2627
go.Indicator(
2728
mode="number",
2829
value=sg.query([last_metric.marketCap]),
2930
number={"prefix": "$", "valueformat": ".2s"},
3031
title={"text": "Market Cap"},
31-
domain={'y': [0, 1], 'x': [0.25, 0.75]}
32-
)
32+
domain={'y': [0, 0.5], 'x': [0.25, 0.75]}
33+
),
3334
)
3435

35-
# Net Asset Value / Total Treasury Value ($) indicator
36-
nav_fig = go.Figure(
36+
metric_fig.add_trace(
37+
# Net Asset Value / Total Treasury Value ($) indicator
3738
go.Indicator(
3839
mode="number",
3940
value=sg.query([last_metric.treasuryMarketValue]),
4041
number={"prefix": "$", "valueformat": ".2s"},
4142
title={"text": "Net Asset Value"},
42-
domain={'y': [0, 1], 'x': [0.25, 0.75]}
43+
domain={'y': [0.5, 1], 'x': [0.25, 0.75]}
4344
)
4445
)
4546

@@ -116,8 +117,12 @@
116117
{"bucket": "Treasury Holdings", "value": treasury_value, "target": 0.48}
117118
]
118119
green_ratio_df = pd.DataFrame.from_records(green_ratio_data)
120+
order = [
121+
'Op Ex', 'Carbon Forwards',
122+
'Carbon Backing', 'Treasury Holdings'
123+
]
124+
119125

120-
# TODO: style colors based on KIP
121126
# TODO: style holdings as $xx.yy[m/k] (i.e. human-formatted like indicators)
122127
# TODO: visualize targets in some way
123128
# TODO: load targets from Google Sheet for ease of maintenance
@@ -129,23 +134,54 @@
129134
'Carbon Forwards': '#6fff93',
130135
'Carbon Backing': '#00cc33',
131136
'Treasury Holdings': '#ddf641'
132-
}
137+
},
138+
category_orders={'bucket': order},
139+
title="Green Ratio: Current",
140+
)
141+
green_ratio_fig.update_layout(
142+
title_x=0.5,
143+
legend=dict(
144+
yanchor='bottom',
145+
y=-.5,
146+
xanchor='auto',
147+
x=.5
148+
)
133149
)
134150

135-
# target_indicators =
151+
green_ratio_target_fig = px.pie(
152+
green_ratio_df, values="target",
153+
names="bucket", hole=.3, color="bucket",
154+
color_discrete_map={
155+
'Op Ex': '#f2ae00',
156+
'Carbon Forwards': '#6fff93',
157+
'Carbon Backing': '#00cc33',
158+
'Treasury Holdings': '#ddf641'
159+
},
160+
category_orders={'bucket': order},
161+
title="Green Ratio: Target",
162+
)
163+
green_ratio_target_fig.update_layout(
164+
title_x=0.5,
165+
legend=dict(
166+
yanchor='bottom',
167+
y=-.5,
168+
xanchor='auto',
169+
x=.5
170+
)
171+
)
136172

137173
layout = dbc.Container([
138174
html.Div([
139175
dbc.Row([
140176
dbc.Col([
141-
dcc.Graph(figure=mc_fig)
142-
], xs=12, sm=12, md=12, lg=3, xl=3),
143-
dbc.Col([
144-
dcc.Graph(figure=nav_fig)
145-
], xs=12, sm=12, md=12, lg=3, xl=3),
177+
dcc.Graph(figure=metric_fig)
178+
], xs=12, sm=12, md=12, lg=4, xl=4),
146179
dbc.Col([
147180
dcc.Graph(figure=green_ratio_fig)
148-
], xs=12, sm=12, md=12, lg=6, xl=6),
181+
], xs=12, sm=6, md=6, lg=4, xl=4),
182+
dbc.Col([
183+
dcc.Graph(figure=green_ratio_target_fig)
184+
], xs=12, sm=6, md=6, lg=4, xl=4)
149185
]),
150186
], className='center'),
151187
], id='page_content_hud', fluid=True)

0 commit comments

Comments
 (0)