Dynamic R Visualization in SAP Analytics Cloud
Author: Geetha Madhuri Bobbili
LinkedIn Profile: https://www.linkedin.com/in/geetha-madhuri-bobbili-971268184/
In this blog, we will create an Analytic application to switch between two different R visualizations. For R Visualization basics in SAP Analytics Cloud, please refer to this blog.
Step 1: Create the R Visualization in Analytic application.
i. Name the R visualization as RVIZ_1. Within the Builder panel of the RVIZ_1 widget, choose the Add Input Data button.
ii. Here I have selected the model: BestRunJuice_SampleModel as input data for my R visualization.
iii. Choose the Add Dimensions button and select the required dimensions. I have selected Date, Sales Manager, Location and Product in the Rows. Gross Margin, Original Sales Price and Quantity Sold in Columns.
iv. Within the Builder panel, click on the entry BestRunJuice_SampleModel and rename it to Model.
v. Within the Builder panel, choose the Add Script button. Type the following code into the Editor section.
vi. The R script will create an animated scatter chart displaying the measures Quantity sold on the x-axis and Gross Margin on the y-axis. The data points for each Sales Manager should be visualized in a different color.
vii. Define an if/else logic within the R script to either visualize Scatter chart or Bar chart.
Step 2: Create an Input Control to filter the Charts by Sales Manager.
Step 3: Create two buttons to switch between different R Visualization Styles.
Create the buttons BUTTON_SCATTER_CHART and BUTTON_BAR_CHART and define the following script logic.
Click on the Buttons within the Outline area and choose the Edit Script button and select the onClick option to start the script editor.
Step 4: Save and run the Analytic Application .
Select one of the sales managers in the Input Control, choose the buttons and check if the chart changes.
Now we have created Dynamic R Visualizations in SAP Analytics Cloud.
Hi, do you know by chance if it is also possible to pass story filters directly to Live HANA data models?
Should be doable. At least I have done the same with BW Live data models already....
Can you give me some hints how to achieve this?
Thanks, br, WM