@@ -437,12 +437,12 @@ def wind_direction_graph(df_wind, history_rgb, forecast_rgb):
437
437
)
438
438
return fig
439
439
440
+
440
441
@app .callback (
441
442
Output (component_id = 'all_info' , component_property = "children" ),
442
443
Input (component_id = "interval" , component_property = "n_intervals" )
443
444
)
444
445
def generate_page (n_intervals ):
445
-
446
446
try :
447
447
logging .info (f"Regenerating info div: times regenerated = { n_intervals } " )
448
448
df = create_df ()
@@ -461,6 +461,17 @@ def generate_page(n_intervals):
461
461
forecast_rgb = FORECAST_RGB
462
462
)
463
463
464
+ fig_temp_historical = create_time_figure (
465
+ df ,
466
+ "temperature.temp" ,
467
+ "Temperature (F) - All time" ,
468
+ show_forecast = False ,
469
+ show_history = True ,
470
+ history_rgb = "rgb(255,0,0)" ,
471
+ limit_date_range = False ,
472
+ )
473
+
474
+
464
475
fig_precipitation_prob = create_time_figure (
465
476
df ,
466
477
"precipitation_probability" ,
@@ -480,6 +491,16 @@ def generate_page(n_intervals):
480
491
history_rgb = "rgb(0,255,0)" ,
481
492
forecast_rgb = FORECAST_RGB
482
493
)
494
+ fig_windspeed_historical = create_time_figure (
495
+ df ,
496
+ "wind.speed" ,
497
+ "Wind speed (mph) - All time" ,
498
+ show_forecast = False ,
499
+ show_history = True ,
500
+ history_rgb = "rgb(0,255,0)" ,
501
+ limit_date_range = False
502
+ )
503
+
483
504
484
505
fig_pressure = create_time_figure (
485
506
df ,
@@ -588,7 +609,18 @@ def generate_page(n_intervals):
588
609
history_rgb = "rgb(7,130,255)" ,
589
610
forecast_rgb = FORECAST_RGB
590
611
)
591
- fig_aqi .update_yaxes (type = "category" , categoryorder = "array" , categoryarray = ["great" , "fair" , "moderate" , "poor" , "hazardous" ])
612
+ fig_aqi_historical = create_time_figure (
613
+ adf ,
614
+ "aqi" ,
615
+ "Adjusted AQI - All time" ,
616
+ show_history = True ,
617
+ show_forecast = False ,
618
+ history_rgb = "rgb(7,130,255)" ,
619
+ limit_date_range = False
620
+ )
621
+
622
+ for fig in (fig_aqi , fig_aqi_historical ):
623
+ fig .update_yaxes (type = "category" , categoryorder = "array" , categoryarray = ["great" , "fair" , "moderate" , "poor" , "hazardous" ])
592
624
593
625
trace_pollutants_forecasts = False
594
626
trace_pollutants_markers = "lines"
@@ -726,6 +758,14 @@ def generate_page(n_intervals):
726
758
if len (graphs ) % 2 != 0 :
727
759
divs .append (html .Div (graphs [- 1 ], className = "row" ))
728
760
761
+
762
+ graphs_historical = [
763
+ dcc .Graph (id = "graph_temp_historical" , figure = fig_temp_historical ),
764
+ dcc .Graph (id = "graph_windspeed_historical" , figure = fig_windspeed_historical ),
765
+ dcc .Graph (id = "graph_aqi_historical" , figure = fig_aqi_historical ),
766
+ ]
767
+ divs_historical = [html .Div (g ) for g in graphs_historical ]
768
+
729
769
730
770
# top rows
731
771
common_style = {"width" : "95%" , "height" : "700px" , "margin" : "auto" , "border" : "30px" }
@@ -848,7 +888,7 @@ def generate_page(n_intervals):
848
888
col1 = html .Div ([right_now , g ], className = "six columns" )
849
889
col2 = html .Div (widget , className = "six columns" )
850
890
toprow = html .Div ([col1 , col2 ], className = "row" )
851
- return html .Div ([toprow ] + divs )
891
+ return html .Div ([toprow ] + [ html . H3 ( "Recent Weather Metrics" , style = white_text )] + divs + [ html . H3 ( "Full History" , style = white_text )] + divs_historical )
852
892
except BaseException :
853
893
exc_type , exc_value , exc_traceback = sys .exc_info ()
854
894
tbf = traceback .format_exception (exc_type , exc_value , exc_traceback )
0 commit comments