Spaces:
Sleeping
Sleeping
gauravlochab
commited on
Commit
·
9bcd921
1
Parent(s):
ff98712
feat: enable auto-ranging for x-axis and y-axis in APR and ROI charts
Browse files
modius_performance/visualization/apr_charts.py
CHANGED
|
@@ -101,13 +101,11 @@ class APRChart(BaseChart):
|
|
| 101 |
y_range=[y_range['min'], y_range['max']]
|
| 102 |
)
|
| 103 |
|
| 104 |
-
#
|
| 105 |
-
last_valid_date = avg_apr_data['timestamp'].max() if not avg_apr_data.empty else max_time
|
| 106 |
-
|
| 107 |
self._update_axes(
|
| 108 |
fig,
|
| 109 |
-
x_range=
|
| 110 |
-
|
| 111 |
)
|
| 112 |
|
| 113 |
# Add region-specific annotations for positive and negative areas
|
|
|
|
| 101 |
y_range=[y_range['min'], y_range['max']]
|
| 102 |
)
|
| 103 |
|
| 104 |
+
# Use auto-range for both x-axis and y-axis to show all available data
|
|
|
|
|
|
|
| 105 |
self._update_axes(
|
| 106 |
fig,
|
| 107 |
+
x_range=None, # Let plotly auto-determine the best x-axis range
|
| 108 |
+
y_auto=True # Let plotly auto-determine the best y-axis range
|
| 109 |
)
|
| 110 |
|
| 111 |
# Add region-specific annotations for positive and negative areas
|
modius_performance/visualization/base_chart.py
CHANGED
|
@@ -87,9 +87,9 @@ class BaseChart(ABC):
|
|
| 87 |
legend=dict(
|
| 88 |
orientation="h",
|
| 89 |
yanchor="bottom",
|
| 90 |
-
y=1.
|
| 91 |
-
xanchor="
|
| 92 |
-
x=
|
| 93 |
groupclick="toggleitem",
|
| 94 |
font=dict(
|
| 95 |
family=self.config['font_family'],
|
|
@@ -98,7 +98,7 @@ class BaseChart(ABC):
|
|
| 98 |
weight="bold"
|
| 99 |
)
|
| 100 |
),
|
| 101 |
-
margin=dict(r=30, l=120, t=
|
| 102 |
hovermode="closest"
|
| 103 |
)
|
| 104 |
|
|
|
|
| 87 |
legend=dict(
|
| 88 |
orientation="h",
|
| 89 |
yanchor="bottom",
|
| 90 |
+
y=1.05,
|
| 91 |
+
xanchor="center",
|
| 92 |
+
x=0.5,
|
| 93 |
groupclick="toggleitem",
|
| 94 |
font=dict(
|
| 95 |
family=self.config['font_family'],
|
|
|
|
| 98 |
weight="bold"
|
| 99 |
)
|
| 100 |
),
|
| 101 |
+
margin=dict(r=30, l=120, t=80, b=60),
|
| 102 |
hovermode="closest"
|
| 103 |
)
|
| 104 |
|
modius_performance/visualization/roi_charts.py
CHANGED
|
@@ -111,13 +111,11 @@ class ROIChart(BaseChart):
|
|
| 111 |
y_range=[y_range['min'], y_range['max']]
|
| 112 |
)
|
| 113 |
|
| 114 |
-
#
|
| 115 |
-
last_valid_date = avg_roi_data['timestamp'].max() if not avg_roi_data.empty else max_time
|
| 116 |
-
|
| 117 |
self._update_axes(
|
| 118 |
fig,
|
| 119 |
-
x_range=
|
| 120 |
-
|
| 121 |
)
|
| 122 |
|
| 123 |
# Save chart
|
|
|
|
| 111 |
y_range=[y_range['min'], y_range['max']]
|
| 112 |
)
|
| 113 |
|
| 114 |
+
# Use auto-range for both x-axis and y-axis to show all available data
|
|
|
|
|
|
|
| 115 |
self._update_axes(
|
| 116 |
fig,
|
| 117 |
+
x_range=None, # Let plotly auto-determine the best x-axis range
|
| 118 |
+
y_auto=True # Let plotly auto-determine the best y-axis range
|
| 119 |
)
|
| 120 |
|
| 121 |
# Save chart
|