I am trying to animate a stacked barchart over time. As time passes I want the graph to populate on the screen. I want the gif to start with the empty graph and then as time passes fill in the chart horizontally.
Below is the code to create the stacked barcharts.
proc import datafile = "C:\Users\...\Desktop\model.xlsx"
dbms = xlsx
out = model
REPLACE;
run;
data am;
set model;
if time > "12:00"t then delete;
format time timeampm9.;
run;
data pm;
set model;
if time <= "12:00"t then delete;
format time timeampm9.;
run;
data myattrmap;
length linecolor $ 9 fillcolor $ 9;
input ID $ value $ linecolor $ fillcolor $;
datalines;
myid OX yellow yellow
myid SS orange orange
myid WS purple purple
myid ES green green
myid HS lightblue lightblue
myid IS blue blue
myid JH red red
;
run;
proc sgplot data = am dattrmap = myattrmap;
title 'Deployment Model AM';
vbar time /response = buses stat = sum group = Group datalabel seglabel attrid=myid;
xaxis display =(nolabel) valuesrotate=vertical values = ("6:15"t to "09:00"t by "0:05"t);
yaxis grid values = (0 to 40 by 5);
refline "7:30 AM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = green) label = "7:30 AM";
refline "7:50 AM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = red) label = "7:50 AM";
refline "8:20 AM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = lightblue) label = "8:20 AM";
refline "8:50 AM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = blue) label = "8:50 AM";
run;
proc sgplot data = pm dattrmap = myattrmap;
title 'Deployment Model PM';
vbar time /response = buses stat = sum group = Group datalabel seglabel attrid=myid;
xaxis display =(nolabel) valuesrotate=vertical values = ("14:00"t to "16:50:00"t by "0:05"t);
yaxis grid values = (0 to 40 by 5);
refline "2:20 PM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = green) label = "2:20 PM";
refline "2:50 PM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = red) label = "2:50 PM";
refline "3:20 PM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = lightblue) label = "3:20 PM";
refline "3:50 PM" /
axis = x lineattrs=(pattern=2 thickness = 2 color = blue) label = "3:50 PM";
run;