File size: 2,443 Bytes
05da27e
df5d610
 
33bd81d
05da27e
8c84121
 
 
b70e3b6
 
1cc7896
 
 
 
 
 
 
 
 
 
 
 
 
 
df5d610
a947d04
1cc7896
33bd81d
 
 
df5d610
a5b586d
df5d610
 
 
 
 
 
 
 
 
 
9639d4f
 
 
 
 
 
 
 
 
 
a5b586d
 
 
 
 
 
 
56a29e2
a0f0017
 
 
33bd81d
a0f0017
 
33bd81d
a0f0017
 
33bd81d
a5b586d
 
08690ca
a5b586d
 
9639d4f
 
 
08690ca
a5b586d
9639d4f
 
08690ca
a5b586d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Set page layout to wide
st.set_page_config(layout="wide")

st.title("CEO Dashboard")

# Get Information
df = pd.read_csv("CEO.csv")

# Get Numbers
kpi1_value = df['Overall Revenue Growth'].iloc[-1]
kpi2_value = df['Revenue'].iloc[-1]
kpi3_value = df['Cost'].iloc[-1]
kpi4_value = df['Profit'].iloc[-1]

kpi1_percentage = df['Overall Revenue Growth'].iloc[-1] - df['Overall Revenue Growth'].iloc[-2]
kpi2_percentage = df['Revenue'].iloc[-1]/df['Revenue'].iloc[-2]-1
kpi3_percentage = df['Cost'].iloc[-1]/df['Cost'].iloc[-2]-1
kpi4_percentage = df['Profit'].iloc[-1]/df['Profit'].iloc[-2]-1

# Existing metric cards code
col1, col2, col3, col4 = st.columns(4)
col1.metric("Market Share", kpi1_value, kpi1_percentage)
col2.metric("Revenue", kpi2_value, kpi2_percentage)
col3.metric("Cost", kpi3_value, kpi3_percentage)
col4.metric("Profit", kpi4_value, kpi4_percentage)

# Fake data for the bar charts
data1 = pd.DataFrame({
    'QTR': ['Q1', 'Q2', 'Q3', 'Q4'],
    'Market Share': np.random.randint(10, 20, size=4)
})

data2 = pd.DataFrame({
    'QTR': ['Q1', 'Q2', 'Q3', 'Q4'],
    'Market Share': np.random.randint(20, 30, size=4)
})

data3 = pd.DataFrame({
    'QTR': ['Q1', 'Q2', 'Q3', 'Q4'],
    'Market Share': np.random.randint(30, 40, size=4)
})

data4 = pd.DataFrame({
    'QTR': ['Q1', 'Q2', 'Q3', 'Q4'],
    'Market Share': np.random.randint(40, 50, size=4)
})

# Reduced height for the bar charts
chart_height = 200

# Creating the bar charts
col1, col2 = st.columns(2)

with col1:
    st.write("Overall Revenue Growth for the Last 4 Quarters")
    # Selecting only the last 4 quarters (assuming df is already sorted by time)
    last_four_quarters = df.tail(4)
    
    # Plotting with Matplotlib
    fig, ax = plt.subplots(figsize=(6, 4))  # Reduced figure size
    ax.bar(last_four_quarters['Quarter'], last_four_quarters['Overall Revenue Growth'])
    ax.set_ylabel('Overall Revenue Growth (%)')
    plt.xticks(rotation=45)  # Rotate quarter labels for better readability

    st.pyplot(fig)

with col2:
    st.write("Kuch tho bhi1")
    st.bar_chart(data2.set_index('QTR'), height=chart_height)

col3, col4 = st.columns(2)

with col3:
    st.write("Kuch tho bhi1")
    st.bar_chart(data3.set_index('QTR'), height=chart_height)

with col4:
    st.write("Kuch tho bhi1")
    st.bar_chart(data4.set_index('QTR'), height=chart_height)