Skip to content

Commit 1aa9dd2

Browse files
committed
Add main charts for Income Statement tab
1 parent 8cbb618 commit 1aa9dd2

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

src/ui/layout.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ def render_balance_sheet(financial_data, financial_calculations):
312312
y=balance_sheet["Total Assets"].values,
313313
name="Total Assets",
314314
marker_color="forestgreen",
315+
marker=dict(cornerradius="5%"),
315316
),
316317
go.Bar(
317318
x=balance_sheet.index,
@@ -320,6 +321,7 @@ def render_balance_sheet(financial_data, financial_calculations):
320321
].values,
321322
name="Total Liabilities",
322323
marker_color="tomato",
324+
marker=dict(cornerradius="5%"),
323325
),
324326
]
325327
)
@@ -337,6 +339,8 @@ def render_balance_sheet(financial_data, financial_calculations):
337339
y=balance_sheet["Total Debt"].values,
338340
name="Total Debt",
339341
marker_color="tomato",
342+
marker=dict(cornerradius="5%"),
343+
width=0.4,
340344
)
341345
]
342346
)
@@ -356,6 +360,8 @@ def render_balance_sheet(financial_data, financial_calculations):
356360
y=balance_sheet["Invested Capital"].values,
357361
name="Invested Capital",
358362
marker_color="forestgreen",
363+
marker=dict(cornerradius="5%"),
364+
width=0.4,
359365
)
360366
]
361367
)
@@ -372,6 +378,8 @@ def render_balance_sheet(financial_data, financial_calculations):
372378
y=balance_sheet["Working Capital"].values,
373379
name="Working Capital",
374380
marker_color="dodgerblue",
381+
marker=dict(cornerradius="5%"),
382+
width=0.4,
375383
)
376384
]
377385
)
@@ -537,6 +545,106 @@ def render_income_stmt(financial_data, financial_calculations):
537545
delta=f"{ebitda_diff:,} ({ebitda_change:.2f}%)",
538546
)
539547

548+
st.divider()
549+
550+
# Render Charts
551+
with st.container():
552+
income, expenses = st.columns(2)
553+
554+
with income:
555+
fig = go.Figure(
556+
data=[
557+
go.Bar(
558+
x=income_stmt.index,
559+
y=income_stmt["Net Income"].values,
560+
name="Net Income",
561+
marker_color="mediumseagreen",
562+
marker=dict(cornerradius="5%"),
563+
),
564+
go.Bar(
565+
x=income_stmt.index,
566+
y=income_stmt["Operating Income"].values,
567+
name="Operating Income",
568+
marker_color="forestgreen",
569+
marker=dict(cornerradius="5%"),
570+
),
571+
]
572+
)
573+
fig.update_layout(
574+
xaxis=dict(type="category"),
575+
title="Net Income vs Operating Income",
576+
)
577+
st.plotly_chart(fig, use_container_width=True)
578+
579+
with expenses:
580+
fig = go.Figure(
581+
data=[
582+
go.Bar(
583+
x=income_stmt.index,
584+
y=income_stmt["General And Administrative Expense"].values,
585+
name="Administrative Expense",
586+
marker_color="dodgerblue",
587+
marker=dict(cornerradius="5%"),
588+
width=0.6,
589+
),
590+
go.Bar(
591+
x=income_stmt.index,
592+
y=income_stmt["Selling And Marketing Expense"].values,
593+
name="Marketing Expense",
594+
marker_color="lightskyblue",
595+
marker=dict(cornerradius="5%"),
596+
width=0.6,
597+
),
598+
go.Bar(
599+
x=income_stmt.index,
600+
y=income_stmt["Research And Development"].values,
601+
name="Research Expense",
602+
marker_color="steelblue",
603+
marker=dict(cornerradius="5%"),
604+
width=0.6,
605+
),
606+
]
607+
)
608+
fig.update_layout(
609+
xaxis=dict(type="category"), title="Expenses Breakdown", barmode="stack"
610+
)
611+
st.plotly_chart(fig, use_container_width=True)
612+
613+
with st.container():
614+
eps, ebitda = st.columns(2)
615+
616+
with eps:
617+
fig = go.Figure(
618+
data=[
619+
go.Bar(
620+
x=income_stmt.index,
621+
y=income_stmt["Diluted EPS"].values,
622+
name="EPS",
623+
marker_color="forestgreen",
624+
marker=dict(cornerradius="5%"),
625+
width=0.4,
626+
)
627+
]
628+
)
629+
fig.update_layout(xaxis=dict(type="category"), title="EPS Evolution")
630+
st.plotly_chart(fig, use_container_width=True)
631+
632+
with ebitda:
633+
fig = go.Figure(
634+
data=[
635+
go.Bar(
636+
x=income_stmt.index,
637+
y=income_stmt["EBITDA"].values,
638+
name="EBITDA",
639+
marker_color="dodgerblue",
640+
marker=dict(cornerradius="5%"),
641+
width=0.4,
642+
)
643+
]
644+
)
645+
fig.update_layout(xaxis=dict(type="category"), title="EBITDA Evolution")
646+
st.plotly_chart(fig, use_container_width=True)
647+
540648
st.divider()
541649
# Render Income Statement Overview
542650
st.markdown("#### Income Statement Overview")

0 commit comments

Comments
 (0)