BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
illmatic
Quartz | Level 8

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.

 

illmatic_0-1680301028595.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
HunterT_SAS
SAS Employee

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):

HunterT_SAS_0-1680523349972.png

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.

View solution in original post

6 REPLIES 6
illmatic
Quartz | Level 8

I don't think I can do this in VA...?

HunterT_SAS
SAS Employee

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):

HunterT_SAS_0-1680523349972.png

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.

illmatic
Quartz | Level 8

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. 

HunterT_SAS
SAS Employee

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.

BrunoMueller
SAS Super FREQ

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:

Bruno_SAS_0-1680780439109.png

To build the custom graph:

  • add a schedule chart
  • if you want to have different colors for the different events, the schedule chart needs a group role
  • then add the series plot (so it is on top of the schedule chart)
  • check all the roles for the correct type
  • save it

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;

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 6 replies
  • 916 views
  • 2 likes
  • 4 in conversation