As we all know SAP Analytics cloud provides wide variety of Geo – Maps with multiple layers. But the help of R programming, you can add 3D globe to your story which could make better user experience. This blog is just to highlight the power of R and how can we use it in SAC to add complex charts. Though 3D charts have been used just to make dashboards visually splendid, these charts often dilute the information which is being presented, due to reduced readability.
You can either use it to your advantage or choose a more appropriate chart type.
Here I have found a use case where we can add a 3D rotational map in SAC to view the No of Confirmed cases across various countries and highlight the countries with more number of confirmed cases in darker colour.
Users can rotate the 3D globe by mouse and hover over the countries to see the count of confirmed cases.
I am not going to delve deep into the definitions and explanations of how to use R within SAC. You can find multiple articles on web. You can create it using the library(Plotly) and plot_geo( ) function in R.
Step 1: Assign data to data frame (df). In SAC , you can assign the model which you have created to df().
Step 2 : Set country boundries to any of the colour
boundary <- list(color = toRGB(“#000000”), width = 0.5)
Step 3: Specify Map projections and options :
mapOptions <- list(
showframe = FALSE,
showcoastlines = FALSE,
projection = list(type = ‘orthographic’),
resolution = ‘100’,
showcountries = TRUE,
countrycolor = ‘#d1d1d1’,
showocean = TRUE,
oceancolor = ‘#000000’,
showlakes = TRUE,
lakecolor = ‘#99c0db’
Step 4 : plot_geo() -> Use this function to initialize a plotly-geo object.
After adding the script , the geo-map will be plotted. In this demo, I have created a model having 3 fields : Country, Country Code and No of Confirmed Cases. You can have any business scenario where the data can be plotted on Geo Maps and show 3D Geo Maps for better UX :
Please note , the data used in the demo are just mocked up and nor real Covid-19 numbers.
Here is the video shows how it works in SAC:-
- 3D charts are not good for readability so it is very important to use only if you have proper use case.
- Ggplot2 – This is the main library in R by which most of the charts can be created in SAC.
- R provides you advanced charts other than standard SAC charts which can be used in the stories for better UX.