@@ -477,20 +477,46 @@ def create_monthly_max_chart(
477477 safe_metric = metric_name .replace ("." , "_" ).replace ("/" , "_" )
478478 png_filename = f"gpu_report_max_{ safe_metric } _by_month.png"
479479
480- # Collect all unique workspaces and months
480+ # Collect all unique workspaces and existing months
481481 all_workspaces = set ()
482- all_months = sorted (data .keys ())
482+ existing_months = sorted (data .keys ())
483483
484484 for month_data in data .values ():
485485 all_workspaces .update (month_data .keys ())
486486
487487 all_workspaces = sorted (all_workspaces )
488488
489- if not all_workspaces or not all_months :
489+ if not all_workspaces or not existing_months :
490490 if debug :
491491 print (f"No workspace or month data for metric { metric_name } " )
492492 return None
493493
494+ # Generate complete list of months from earliest to latest
495+ if len (existing_months ) > 0 :
496+ # Parse first and last month
497+ start_year , start_month = map (int , existing_months [0 ].split ("-" ))
498+ end_year , end_month = map (int , existing_months [- 1 ].split ("-" ))
499+
500+ # Generate all months between start and end
501+ all_months = []
502+ current_year = start_year
503+ current_month = start_month
504+
505+ while True :
506+ month_key = f"{ current_year :04d} -{ current_month :02d} "
507+ all_months .append (month_key )
508+
509+ if current_year == end_year and current_month == end_month :
510+ break
511+
512+ # Move to next month
513+ current_month += 1
514+ if current_month > 12 :
515+ current_month = 1
516+ current_year += 1
517+ else :
518+ all_months = existing_months
519+
494520 # Create line chart
495521 fig , ax = plt .subplots (figsize = (14 , 8 ))
496522
@@ -501,7 +527,7 @@ def create_monthly_max_chart(
501527 for i , workspace in enumerate (all_workspaces ):
502528 values = []
503529 for month in all_months :
504- value = data [ month ] .get (workspace )
530+ value = data . get ( month , {}) .get (workspace )
505531 values .append (value if value is not None else None )
506532
507533 ax .plot (
0 commit comments