06-23-2014 03:38 AM
I would like to create a dynamic chart where the graph is refreshed in between short time intervals of say 5 seconds with different events plotted on the chart.
I have created a macro that creates a separate dataset for each event and within the macro have provided the plot graph function. So for each iteration(i.e each event) there will be a graph created.
Below is the described code I have created in Base SAS.But I am getting say 7 graphs for 7 events on the same page,wherein I want only a single graph to refresh every 5 seconds with the latest iterated event.
Any help for the code change below will be appreciated.
proc sql noprint;
select count(distinct Event)
select distinct Event
into :Event1 - :Event%left(&n)
%do i=1 %to &n;
data &&Event&i (drop=Event);
proc gplot data=&&Event&i ;
plot magnitude*duration / annotate = annocbema haxis = axis1 vaxis = axis2 html=tips1;
plot2 magnitude*incident /
haxis = axis1 vaxis = axis2 html=tips1/*noframe*/
des="" name="&name" ;
06-23-2014 04:11 AM
Sorry, I am not following your question: " I want only a single graph to refresh every 5 seconds with the latest iterated event". Graphs are output, there is no 'refresh', you would need to run the program again. Maybe you want to output each graph to a separate file, e.g. graph_output_time_0, graph_output_time_5, ...?
01-20-2015 02:38 PM
I'm not sure I understand exactly what you're wanting, but here are a couple of possibilities:
If you know all the 7 events ahead of time, I guess you could create a gif animation, with 5 second delay between each frame. There are several examples of animated gif graphs on this page:
Alternatively, if the data you're wanting to plot is happening 'live' (ie, you don't have all the data ahead of time), and you're wanting a graph to 'refresh' itself every 5 seconds, you could possibly do that with SAS/Intrnet. With SAS/Intrnet, it generates the graph on-the-fly when you go to the url. The graph can be set up to read the latest/greatest data whenever it is run.
I have one SAS/Intrnet example that queries the time, and draws a representation of a clock every time it's run. I set it up to refresh itself every 5 seconds using the following code after my proc gchart (this is just a portion - not the entire sas/intrnet job) ...
proc gchart data=a;
pie category / sumvar=seconds clockwise noheading
coutline=blue slice=none des='';
See the following webpage for info about 'refresh' ...
put "<meta http-equiv='refresh' content='&refresh'>";