BookmarkSubscribeRSS Feed

SAS Visual Analytics: Synchronized Hierarchies with Custom Graphs

Started 6 hours ago by
Modified 6 hours ago by
Views 30

With the SAS Custom Graph Builder, you can create a huge variety of custom graphs. The SAS Graph Builder enables users to create custom visualizations that can be used as a graph object in a SAS Visual Analytics report. Check out GitHub - sassoftware/va-custom-graphs, which provides pre-built SAS custom graphs and their supporting files  

 

One frequent question I get asked is how to create synchronized drill down in a hierarchy with multiple objects simultaneously. You can achieve this using the SAS Custom Graph Builder. These are the steps to take:  

 

  1. Create a custom graph with multiple graphs arranged in a user-defined lattice.
  2. Modify the roles of the graphs to use a shared role.
  3. Save the custom graph.
  4. Import the custom graph into Visual Analytics and add it to a report.
  5. Assign a hierarchy to the custom graph and test it out!

 

For this post, we will create a custom graph with two bar charts.  

 

 

Creating the Custom Graph

 

To access the Custom Graph Builder, access the SAS Viya Applications menu and click on Build Custom Graphs:

 

01_NR_42818_6_1_BuildCustomGraphs.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

Then click on New Custom Graph:

 

02_NR_42818_6_2_NewCustomGraph.png

 

From the Elements pane on the left, scroll down and drag the Bar Chart onto the canvas:

 

03_NR_42818_6_3_DragBarChart1.png

 

Then, drag another Bar Chart to the side of the existing one:

 

04_NR_42818_6_4_DragBarChart2-1024x513.png

 

We now have created a user-defined lattice of graphs. Note you can of course use any number and combination of graphs for the synchronized hierarchies.  

 

We now have to configure the roles of this custom graph. We need to indicate that all the graphs should share their Category role. To do this, click on the Roles pane on the right, and click the More menu next to Bar Chart 2 Category, then Create Shared Role with another Role and Bar Chart 1 Category. You can name the shared role Shared Hierarchy, which will accept any variables of Role Category. Click OK:

 

05_NR_42818_6_5_AddSharedRole-1024x513.png

 

Note that the legend appears to be duplicated. This is because by default the legend of each constituting chart is displayed, which is not necessary as they share the Category role. To resolve this, in the Options pane on the right, under Discrete Legend, uncheck the checkbox for Bar Chart 2.

 

06_NR_42818_6_6_DiscreteLegend-1024x513.png

 

We have finished creating the custom graph. We now need to save it in a location accessible to all report creators wishing to use it. Report viewers do not need to access the custom graph. For the purposes of this post, I will save it in My Folder (note this means it is not accessible to anyone but me):

 

07_NR_42818_6_7_SaveAs-1024x513.png

 

 

Using the Custom Graph

 

We can now return to Visual Analytics. To do this, from the Viya Applications menu, click on Explore and Visualize. Create a report and add data, or open an existing report. Every report creator wishing to utilise the custom graph needs to import it into Visual Analytics. To do this, from the right pane, select Objects, then select the Objects menu and click on Import custom graph.

 

08_NR_42818_6_8_ImportCustomGraph-1024x582.png

 

Note that if you update the custom graph in Custom Graph Builder, you will need to delete the object from the Objects pane, and then re-import it into Visual Analytics.

 

Select your custom graph. Once imported, drag it onto the canvas of your report. Assign any hierarchy to the Category role and the other measures as you wish (see the first example in Creating Hierarchies to use in SAS Visual Analytics Reports for instructions on creating hierarchies and assigning it to an object). Then drill down by double-clicking on a segment in one chart. You will see that this will drill down into the hierarchy in the other chart as well:

 

09_NR_42818_6_9_FinalGraph-1024x513.png

 

 

Conclusion

 

This is just one example - you can use any number or combination of graphs for this synchronized drill down. Let your imagination run free!

 

 

Find more articles from SAS Global Enablement and Learning here.

Contributors
Version history
Last update:
6 hours ago
Updated by:

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags