berangerthomas commited on
Commit
36445e1
·
1 Parent(s): 73f708b

Time series graph now using plotly in alerts view

Browse files
Files changed (1) hide show
  1. sections/alerts.py +9 -11
sections/alerts.py CHANGED
@@ -178,18 +178,16 @@ else:
178
  )
179
  error_count.columns = [timestamp_col, "count"]
180
 
181
- # Create the chart
182
- chart = (
183
- alt.Chart(error_count)
184
- .mark_line()
185
- .encode(
186
- x=alt.X(f"{timestamp_col}:T", title="Time"),
187
- y=alt.Y("count:Q", title="Number of errors"),
188
- tooltip=[f"{timestamp_col}:T", "count:Q"],
189
- )
190
- .properties(width=700, height=300, title="Errors per hour")
191
  )
192
- st.altair_chart(chart, use_container_width=True)
193
  else:
194
  st.success("No critical errors detected in the logs.")
195
 
 
178
  )
179
  error_count.columns = [timestamp_col, "count"]
180
 
181
+ # Create the chart with plotly
182
+ import plotly.express as px
183
+
184
+ fig = px.line(
185
+ error_count, x=timestamp_col, y="count", title="Errors per hour"
186
+ )
187
+ fig.update_layout(
188
+ xaxis_title="Time", yaxis_title="Number of errors", height=300
 
 
189
  )
190
+ st.plotly_chart(fig, use_container_width=True)
191
  else:
192
  st.success("No critical errors detected in the logs.")
193