mijtsma3 commited on
Commit
cc1a80e
·
1 Parent(s): 88cf1e2

Axes move with "Now"

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. src/viz.py +24 -3
app.py CHANGED
@@ -345,5 +345,5 @@ if __name__ == '__main__':
345
  labels = list(data_store[list(data_store.keys())[0]]['aircraft_data'][list(data_store[list(data_store.keys())[0]]['aircraft_data'].keys())[0]].columns.tolist()) # Extracting column names for the first aircraft-specific dataframe
346
  print(subfolder_labels)
347
  # webbrowser.open_new("http://127.0.0.1:8050/")
348
- # app.run_server(debug=True)
349
- app.run_server(debug=True, host='0.0.0.0', port=7860)
 
345
  labels = list(data_store[list(data_store.keys())[0]]['aircraft_data'][list(data_store[list(data_store.keys())[0]]['aircraft_data'].keys())[0]].columns.tolist()) # Extracting column names for the first aircraft-specific dataframe
346
  print(subfolder_labels)
347
  # webbrowser.open_new("http://127.0.0.1:8050/")
348
+ # app.run(debug=True)
349
+ app.run(debug=True, host='0.0.0.0', port=7860)
src/viz.py CHANGED
@@ -114,6 +114,21 @@ class Visualizer:
114
 
115
  color_index = (color_index + 1) % len(colors) # Update color index for the next trace
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  figure_handle.update_layout(
118
  xaxis_title='Real Time',
119
  yaxis_title='Comprehension of Timeline of Events',
@@ -122,15 +137,21 @@ class Visualizer:
122
  showgrid=False,
123
  showline=True,
124
  linecolor='black',
125
- range=[start_time,end_time]
 
 
 
126
  ),
127
  yaxis=dict(
128
  showgrid=False,
129
  showline=True,
130
  linecolor='black',
131
- range=[start_time,end_time],
132
  scaleanchor="x",
133
- scaleratio=1
 
 
 
134
  ),
135
  plot_bgcolor='white', # Set plot background color to white
136
  paper_bgcolor='white' # Set paper background color to white
 
114
 
115
  color_index = (color_index + 1) % len(colors) # Update color index for the next trace
116
 
117
+ # ----- Custom Tick and "Now" Label Logic -----
118
+ tick_offsets = [-200, -100, 0, 100, 200]
119
+ tick_vals = [current_time + offset for offset in tick_offsets]
120
+ tick_texts = [f"{offset:+}" if offset != 0 else "Now" for offset in tick_offsets]
121
+
122
+ # Replace +0 with "Now", rest: e.g., -200, -100, Now, +100, +200
123
+ tick_texts = []
124
+ for offset in tick_offsets:
125
+ if offset == 0:
126
+ tick_texts.append("Now")
127
+ else:
128
+ # always sign, e.g. "+200", "-100"
129
+ tick_texts.append("{:+}".format(offset))
130
+
131
+ # Update layout with manual ticks and custom 'Now' at both axes, with annotation reinforcing "Now"
132
  figure_handle.update_layout(
133
  xaxis_title='Real Time',
134
  yaxis_title='Comprehension of Timeline of Events',
 
137
  showgrid=False,
138
  showline=True,
139
  linecolor='black',
140
+ range=[start_time, end_time],
141
+ tickvals=tick_vals,
142
+ ticktext=tick_texts,
143
+ tickfont=dict(size=12)
144
  ),
145
  yaxis=dict(
146
  showgrid=False,
147
  showline=True,
148
  linecolor='black',
149
+ range=[start_time, end_time],
150
  scaleanchor="x",
151
+ scaleratio=1,
152
+ tickvals=tick_vals,
153
+ ticktext=tick_texts,
154
+ tickfont=dict(size=12)
155
  ),
156
  plot_bgcolor='white', # Set plot background color to white
157
  paper_bgcolor='white' # Set paper background color to white