Hi all,
Is there a better way to show events as a backdrop in a timeseries graph?
I'd like to make it easier for the reader to see what events were the backdrop to any possible fluctuations in sales.
Here is the current visual coming from 2 separate datasets and 2 separate graphs stacked.
One way to do this in Visual Analytics is to place both of your graphs in a Precision Container, then you can put them on top of each other and end up with something like this (using dummy data I had):
Some tips here:
- Use the Layout section of the Options for each graph to place these charts
- You may need to adjust Transparency options. I did not have to in my example but fyi anyway.
- In the above example in order to get both charts to line up better, I set both Titles to "Events" and I turned off the gridlines for the time series plot.
I don't think I can do this in VA...?
One way to do this in Visual Analytics is to place both of your graphs in a Precision Container, then you can put them on top of each other and end up with something like this (using dummy data I had):
Some tips here:
- Use the Layout section of the Options for each graph to place these charts
- You may need to adjust Transparency options. I did not have to in my example but fyi anyway.
- In the above example in order to get both charts to line up better, I set both Titles to "Events" and I turned off the gridlines for the time series plot.
Hi Hunter,
I started off this way, but the layout would constantly mess up on other people's monitors. I also need the gridlines since I am showing a forecast for many years across many channels.
I can try it again sometime, but the floating graphs were a pain to upkeep, so I gave up.
I was hoping there was some way to utilize the Rules section where I can have the background of the graph highlighted indicating an event...but even if that's possible, there is likely no way to have it show all the information I need.
Thanks for your help! I'm assuming this is the only alternate solution that this point.
Oh yes, precision containers can be a pain when your users have varying screen resolutions and browser zoom levels, so you have a great point there.
I'm afraid there is no better alternative within Visual Analytics. Rules *might* be an option but the data would have to be in the same datasource. You also might be able to utilize custom graph builder to put two graphs together that make sense here (time series and schedule charts are incompatible unfortunately), but this approach also depends on all of the data being in the same datasource.
You did not mention the version of Visual Analytics you are using. Using 2023.03 (I guess earlier 20xx will work as well) I created a custom graph combining a schedule chart with a series plot. The end result looks like this:
To build the custom graph:
To use it, you need to import it into the objects pane.
Please note, if you make changes to the custom graph do the following: delete the object in the report, delete the custom graph from the objects pane, then import again
As this is now only one object the data for schedule chart and series plot has to come from the same data source.
Find below an example on how to create such a CAS table. Essentially you have like two separate tables using mostly different variable names which are then "concatenated". The final table (casuser.ts_combined) is then used in the object created by the custom graph builder and the appropriate data items are assigned to the roles.
cas sugus sessopts=(caslib="casuser");
libname casuser cas caslib="casuser";
proc datasets lib=casuser nolist;
delete ts_complete;
delete ts_series;
delete ts_combined;
run;
quit;
/* create event data */
data casuser.ts_complete(promote=yes);
format activity $12. sdate date9. fdate date9.;
input activity & sdate & date9. fdate & date9.;
datalines;
Event01 01dec2015 05dec2015
Event01 06dec2015 16dec2015
Event01 07dec2015 12dec2015
Event01 17dec2015 03jan2016
Event02 10dec2015 19dec2015
Event02 01jan2016 13jan2016
Event02 13jan2016 21jan2016
Event02 22jan2016 01feb2016
Event03 05feb2016 11feb2016
Event03 12feb2016 12feb2016
Event03 26jan2016 26jan2016
;
/* create series data */
data casuser.ts_series(promote=yes);
length activity $ 12;
/* avoid a missing category for events */
activity = "Event01";
do seriesDate = "01dec2015"d to "15feb2016"d;
seriesValue = rand("integer", 50, 100);
output;
end;
format seriesDate date9.;
run;
/* combine event and series */
data casuser.ts_combined(promote=yes);
set casuser.ts_complete casuser.ts_series;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.