Spaces:
Sleeping
Sleeping
gauravlochab
commited on
Commit
·
0a4dbe7
1
Parent(s):
5ee9210
feat: update graph titles and enhance font styling for clarity and consistency
Browse files
app.py
CHANGED
|
@@ -808,7 +808,15 @@ def create_combined_time_series_graph(df):
|
|
| 808 |
# Update layout - use simple boolean values everywhere
|
| 809 |
# Make chart responsive instead of fixed width
|
| 810 |
fig.update_layout(
|
| 811 |
-
title=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 812 |
xaxis_title=None, # Remove x-axis title to use annotation instead
|
| 813 |
yaxis_title=None, # Remove the y-axis title as we'll use annotations instead
|
| 814 |
template="plotly_white",
|
|
@@ -835,7 +843,7 @@ def create_combined_time_series_graph(df):
|
|
| 835 |
yref="y",
|
| 836 |
text="Percent drawdown",
|
| 837 |
showarrow=False,
|
| 838 |
-
font=dict(size=14, family="Arial, sans-serif", color="black", weight="bold"), #
|
| 839 |
textangle=-90, # Rotate text to be vertical
|
| 840 |
align="center"
|
| 841 |
)
|
|
@@ -847,7 +855,7 @@ def create_combined_time_series_graph(df):
|
|
| 847 |
yref="y",
|
| 848 |
text="Agent APR",
|
| 849 |
showarrow=False,
|
| 850 |
-
font=dict(size=14, family="Arial, sans-serif", color="black", weight="bold"), #
|
| 851 |
textangle=-90, # Rotate text to be vertical
|
| 852 |
align="center"
|
| 853 |
)
|
|
@@ -860,10 +868,28 @@ def create_combined_time_series_graph(df):
|
|
| 860 |
yref="paper",
|
| 861 |
text="Date",
|
| 862 |
showarrow=False,
|
| 863 |
-
font=dict(size=14, family="Arial, sans-serif", color="black", weight="bold"), #
|
| 864 |
align="center"
|
| 865 |
)
|
| 866 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 867 |
# Update y-axis with fixed range of -50 to +100 for psychological effect
|
| 868 |
fig.update_yaxes(
|
| 869 |
showgrid=True,
|
|
@@ -873,7 +899,7 @@ def create_combined_time_series_graph(df):
|
|
| 873 |
autorange=False, # Disable autoscaling
|
| 874 |
range=[-50, 100], # Set fixed range from -50 to +100
|
| 875 |
tickformat=".2f", # Format tick labels with 2 decimal places
|
| 876 |
-
tickfont=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), #
|
| 877 |
title=None # Remove the built-in axis title since we're using annotations
|
| 878 |
)
|
| 879 |
|
|
@@ -886,7 +912,7 @@ def create_combined_time_series_graph(df):
|
|
| 886 |
autorange=True, # Explicitly enable autoscaling
|
| 887 |
tickformat="%b %d", # Simplified date format without time
|
| 888 |
tickangle=-30, # Angle the labels for better readability
|
| 889 |
-
tickfont=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), #
|
| 890 |
title=None # Remove built-in title to use annotation instead
|
| 891 |
)
|
| 892 |
|
|
@@ -1030,7 +1056,15 @@ def create_combined_time_series_graph(df):
|
|
| 1030 |
|
| 1031 |
# Simplified layout with adjusted y-axis range and increased size
|
| 1032 |
simple_fig.update_layout(
|
| 1033 |
-
title=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1034 |
xaxis_title=None, # Remove x-axis title to use annotation instead
|
| 1035 |
yaxis_title=None, # Remove the y-axis title as we'll use annotations instead
|
| 1036 |
yaxis=dict(
|
|
@@ -1054,7 +1088,7 @@ def create_combined_time_series_graph(df):
|
|
| 1054 |
yref="y",
|
| 1055 |
text="Percent drawdown",
|
| 1056 |
showarrow=False,
|
| 1057 |
-
font=dict(size=12, family="Arial, sans-serif", color="black"), #
|
| 1058 |
textangle=-90, # Rotate text to be vertical
|
| 1059 |
align="center"
|
| 1060 |
)
|
|
@@ -1066,7 +1100,7 @@ def create_combined_time_series_graph(df):
|
|
| 1066 |
yref="y",
|
| 1067 |
text="Agent APR",
|
| 1068 |
showarrow=False,
|
| 1069 |
-
font=dict(size=12, family="Arial, sans-serif", color="black"), #
|
| 1070 |
textangle=-90, # Rotate text to be vertical
|
| 1071 |
align="center"
|
| 1072 |
)
|
|
@@ -1079,19 +1113,36 @@ def create_combined_time_series_graph(df):
|
|
| 1079 |
yref="paper",
|
| 1080 |
text="Date",
|
| 1081 |
showarrow=False,
|
| 1082 |
-
font=dict(size=12, family="Arial, sans-serif", color="black"), #
|
| 1083 |
align="center"
|
| 1084 |
)
|
| 1085 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1086 |
# Apply autoscaling to the x-axis for the fallback graph
|
| 1087 |
simple_fig.update_xaxes(
|
| 1088 |
autorange=True, # Explicitly enable autoscaling
|
| 1089 |
tickformat="%b %d", # Simplified date format without time
|
| 1090 |
tickangle=-30,
|
| 1091 |
-
tickfont=dict(size=12),
|
| 1092 |
title=None # Remove built-in title to use annotation instead
|
| 1093 |
)
|
| 1094 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1095 |
# Add a note about hidden agents if there are more than MAX_VISIBLE_AGENTS
|
| 1096 |
if len(unique_agents) > MAX_VISIBLE_AGENTS:
|
| 1097 |
simple_fig.add_annotation(
|
|
|
|
| 808 |
# Update layout - use simple boolean values everywhere
|
| 809 |
# Make chart responsive instead of fixed width
|
| 810 |
fig.update_layout(
|
| 811 |
+
title=dict(
|
| 812 |
+
text="Modius Agents",
|
| 813 |
+
font=dict(
|
| 814 |
+
family="Arial, sans-serif",
|
| 815 |
+
size=22,
|
| 816 |
+
color="black",
|
| 817 |
+
weight="bold"
|
| 818 |
+
)
|
| 819 |
+
),
|
| 820 |
xaxis_title=None, # Remove x-axis title to use annotation instead
|
| 821 |
yaxis_title=None, # Remove the y-axis title as we'll use annotations instead
|
| 822 |
template="plotly_white",
|
|
|
|
| 843 |
yref="y",
|
| 844 |
text="Percent drawdown",
|
| 845 |
showarrow=False,
|
| 846 |
+
font=dict(size=14, family="Arial, sans-serif", color="black", weight="bold"), # Ensure bold weight
|
| 847 |
textangle=-90, # Rotate text to be vertical
|
| 848 |
align="center"
|
| 849 |
)
|
|
|
|
| 855 |
yref="y",
|
| 856 |
text="Agent APR",
|
| 857 |
showarrow=False,
|
| 858 |
+
font=dict(size=14, family="Arial, sans-serif", color="black", weight="bold"), # Ensure bold weight
|
| 859 |
textangle=-90, # Rotate text to be vertical
|
| 860 |
align="center"
|
| 861 |
)
|
|
|
|
| 868 |
yref="paper",
|
| 869 |
text="Date",
|
| 870 |
showarrow=False,
|
| 871 |
+
font=dict(size=14, family="Arial, sans-serif", color="black", weight="bold"), # Ensure bold weight
|
| 872 |
align="center"
|
| 873 |
)
|
| 874 |
|
| 875 |
+
# Update layout for legend
|
| 876 |
+
fig.update_layout(
|
| 877 |
+
legend=dict(
|
| 878 |
+
orientation="h",
|
| 879 |
+
yanchor="bottom",
|
| 880 |
+
y=1.02,
|
| 881 |
+
xanchor="right",
|
| 882 |
+
x=1,
|
| 883 |
+
groupclick="toggleitem",
|
| 884 |
+
font=dict(
|
| 885 |
+
family="Arial, sans-serif",
|
| 886 |
+
size=12,
|
| 887 |
+
color="black",
|
| 888 |
+
weight="bold"
|
| 889 |
+
)
|
| 890 |
+
)
|
| 891 |
+
)
|
| 892 |
+
|
| 893 |
# Update y-axis with fixed range of -50 to +100 for psychological effect
|
| 894 |
fig.update_yaxes(
|
| 895 |
showgrid=True,
|
|
|
|
| 899 |
autorange=False, # Disable autoscaling
|
| 900 |
range=[-50, 100], # Set fixed range from -50 to +100
|
| 901 |
tickformat=".2f", # Format tick labels with 2 decimal places
|
| 902 |
+
tickfont=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), # Ensure bold weight
|
| 903 |
title=None # Remove the built-in axis title since we're using annotations
|
| 904 |
)
|
| 905 |
|
|
|
|
| 912 |
autorange=True, # Explicitly enable autoscaling
|
| 913 |
tickformat="%b %d", # Simplified date format without time
|
| 914 |
tickangle=-30, # Angle the labels for better readability
|
| 915 |
+
tickfont=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), # Ensure bold weight
|
| 916 |
title=None # Remove built-in title to use annotation instead
|
| 917 |
)
|
| 918 |
|
|
|
|
| 1056 |
|
| 1057 |
# Simplified layout with adjusted y-axis range and increased size
|
| 1058 |
simple_fig.update_layout(
|
| 1059 |
+
title=dict(
|
| 1060 |
+
text="Modius Agents",
|
| 1061 |
+
font=dict(
|
| 1062 |
+
family="Arial, sans-serif",
|
| 1063 |
+
size=22,
|
| 1064 |
+
color="black",
|
| 1065 |
+
weight="bold"
|
| 1066 |
+
)
|
| 1067 |
+
),
|
| 1068 |
xaxis_title=None, # Remove x-axis title to use annotation instead
|
| 1069 |
yaxis_title=None, # Remove the y-axis title as we'll use annotations instead
|
| 1070 |
yaxis=dict(
|
|
|
|
| 1088 |
yref="y",
|
| 1089 |
text="Percent drawdown",
|
| 1090 |
showarrow=False,
|
| 1091 |
+
font=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), # Add bold weight
|
| 1092 |
textangle=-90, # Rotate text to be vertical
|
| 1093 |
align="center"
|
| 1094 |
)
|
|
|
|
| 1100 |
yref="y",
|
| 1101 |
text="Agent APR",
|
| 1102 |
showarrow=False,
|
| 1103 |
+
font=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), # Add bold weight
|
| 1104 |
textangle=-90, # Rotate text to be vertical
|
| 1105 |
align="center"
|
| 1106 |
)
|
|
|
|
| 1113 |
yref="paper",
|
| 1114 |
text="Date",
|
| 1115 |
showarrow=False,
|
| 1116 |
+
font=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), # Add bold weight
|
| 1117 |
align="center"
|
| 1118 |
)
|
| 1119 |
|
| 1120 |
+
# Update legend font for fallback graph
|
| 1121 |
+
simple_fig.update_layout(
|
| 1122 |
+
legend=dict(
|
| 1123 |
+
font=dict(
|
| 1124 |
+
family="Arial, sans-serif",
|
| 1125 |
+
size=12,
|
| 1126 |
+
color="black",
|
| 1127 |
+
weight="bold"
|
| 1128 |
+
)
|
| 1129 |
+
)
|
| 1130 |
+
)
|
| 1131 |
+
|
| 1132 |
# Apply autoscaling to the x-axis for the fallback graph
|
| 1133 |
simple_fig.update_xaxes(
|
| 1134 |
autorange=True, # Explicitly enable autoscaling
|
| 1135 |
tickformat="%b %d", # Simplified date format without time
|
| 1136 |
tickangle=-30,
|
| 1137 |
+
tickfont=dict(size=12, family="Arial, sans-serif", color="black", weight="bold"), # Add bold weight
|
| 1138 |
title=None # Remove built-in title to use annotation instead
|
| 1139 |
)
|
| 1140 |
|
| 1141 |
+
# Update y-axis tick font for fallback graph
|
| 1142 |
+
simple_fig.update_yaxes(
|
| 1143 |
+
tickfont=dict(size=12, family="Arial, sans-serif", color="black", weight="bold") # Add bold weight
|
| 1144 |
+
)
|
| 1145 |
+
|
| 1146 |
# Add a note about hidden agents if there are more than MAX_VISIBLE_AGENTS
|
| 1147 |
if len(unique_agents) > MAX_VISIBLE_AGENTS:
|
| 1148 |
simple_fig.add_annotation(
|