os1187 commited on
Commit
b2c0262
·
1 Parent(s): 1037782

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -24,13 +24,26 @@ def plot_usage_volume(system1, users1, timeline1, system2, users2, timeline2):
24
 
25
  # Create a multiline plot of the usage volume for each system
26
  line = alt.Chart(data).mark_line().encode(
27
- x='Month:N',
28
  y='Usage:Q',
29
  color='System:N'
30
  ).properties(title="System Rollout Usage Volume Plot")
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  # Return the plot as a Gradio output
33
- return line
34
 
35
  # Define the input components
36
  inputs = [
 
24
 
25
  # Create a multiline plot of the usage volume for each system
26
  line = alt.Chart(data).mark_line().encode(
27
+ x=alt.X('Month', sort=list(data['Month'].unique())),
28
  y='Usage:Q',
29
  color='System:N'
30
  ).properties(title="System Rollout Usage Volume Plot")
31
 
32
+ # Create an aggregated line for the total usage across both systems
33
+ aggregated_data = data.groupby(['Month']).sum().reset_index()
34
+ aggregated_data['System'] = 'Total'
35
+ data = pd.concat([data, aggregated_data], axis=0)
36
+
37
+ aggregated_line = alt.Chart(aggregated_data).mark_line(color='black').encode(
38
+ x=alt.X('Month', sort=list(data['Month'].unique())),
39
+ y='Usage:Q'
40
+ )
41
+
42
+ # Combine the multiline and aggregated line plots
43
+ chart = alt.layer(line, aggregated_line)
44
+
45
  # Return the plot as a Gradio output
46
+ return chart
47
 
48
  # Define the input components
49
  inputs = [