Skip to Content
Technical Articles

R visualizations in SAP Analytics Cloud Part – 1 ( Gauge Chart )

SAP analytics cloud offers wide variety of charts which users can easily select from designer pane and use it in their stories. But for advanced users, SAP SAC offers the support of R language by the use of which any type of chart can be created in SAC maybe it animation charts, gauge charts, 3D charts, Circular charts, flow charts and many more which you can think of.

R offers The R visualization capabilities within SAP Analytics Cloud enable you to create interactive visualizations for advanced statistical and analytical analyses. You can:

  • Insert R visualizations into your stories
  • Interact with your visualizations, using controls such as filters
  • Edit your R scripts and preview visualizations
  • Share stories containing R visualizations with other users

R packages that are supported by SAP Analytics Cloud

Please go through this link: https://www.sapanalytics.cloud/resources-r-packages/

In this blog, we will be creating the Gauge charts using R scripts.

 

The Definition of Gauges Chart

Gauge charts use needles to show information as a reading on a dial. The value for each needle is easily read against the colored data range. Gauge charts can be used to show the revenue and planned revenue for each sales territory. These gauges charts below demonstrates a single value represented by a red needle.

Gauge charts allow us to visualize data in a way that resembles a real-life speedometer needle or a regular gauge. They usually display a single key measure. The outer scale of the gauge is often color-coded to provide additional performance context.

 

 

 

Now, let’s move on to demo:

I have created a small set of data for this demonstration. But you can use the real time data from your system and create similar kind of charts.

In my example, I have 4 products say Product A, Product B, Product C, Product D and have order values for each of them. Now I would like to see how my products are performing in terms of sales based on the target value set for each product.

Product Order value
Product A 200
Product B 300
Product C 400
Product D 500

 

In SAC, I have created a model using above data and then in the story I have selected the R widget and selected the model. I have added Product in the Dimension.

Then you can go to script and add your code in it :

 

 

In the code above, I have set my gauge range from 0 to 500. Products who have sales between 0 to 200 are categorised under red (means those products are not doing good in terms of sales), products who have sales between 200 to 300 are categorised under yellow and those are above that are categorised under green color. This is how you can add gauge chart in SAC and then based on your project requirements can add/ change the code accordingly.

This purpose of this blog is to show the capabilities of SAC in terms of adding advanced charts if you have some scripting knowledge and provide better UX to your users.

 

Once we submit Apply and Ok, we will see the gauge chart in SAC:

 

Wow!!!!! Isn’t it cool to show these kind of charts to users and get some appreciation 😊

Conclusion : 

 

  • R is the most used language and environment for statistical analysis
  • Most new research results and algorithms are published as R Packages and can be used/tested immediately after they are available so that you can participate in the latest research results and leverage them for your business
  • When seeking help from a statistician or collaborating with a statistician, interacting in a common language would be much more efficient for both sides
  • R makes stunning visualizations — compelling visualizations are essential for every active stakeholder engagement
  • R, as well as the most used IDE: RStudio, is free.

I am planning to write more blogs on R visualization in SAC showing different type of charts we can add in SAC. Please do let me know if you would like to see more on this stuff.

 

 

2 Comments
You must be Logged on to comment or reply to a post.