Introduction
In the age of big data, visualizing and analyzing trillions of rows in a single chart or KPI is very demanding among customers. Many times as developers we need variety of charts which at one glance gives the correct information, analysis and aesthetics on the dashboard/report.
In SAC stories and analytic applications apart from readily provided charts and graphs we can also design variety of other charts using R visualization feature.
Gauge chart is very nice example for showing whether data values fall within an acceptable range or not. We can set the maximum value, the range maximums, and can display ranges in different colors to quickly assess the required value. This type of chart are very intuitive and also help us to identify problems in important data points or measures.
Below given example is of a customized radial gauge which can be used in SAC story and analytic application.
Steps for creation of Gauge chart in SAC
There are two parts of this demo;
- Creation of a simple radial gauge chart
- Customization of a gauge chart
I have created demo model which has following type of data;
To start with , after creation of data model on SAC insert a “R Visualization”.
Select the field from the input data for which gauge chart is required.
- Simple radial gauge chart
To create a basic gauge, On “+Edit script” add below script to the editor and apply;
With above script chart will display like this;
In this snapshot, the total sales of all equipment’s is shown as KPI on the range of gauge.
- Customization of a gauge chart with Delta, Threshold and color ranges
This chart can be customized with addition of delta and threshold and more color ranges using below script.
In above figure, assuming example of sales amount of previous year as 80k the delta is displayed and if the target sales to achieve is 95k a indicator (red) is given.
Color segregation in the gauge is displayed to explain if we want to divide the half, quarter of full range of sales achieved.
Below snapshot is one more example designed to show further more customization.
Conclusion
Referring above given demo, one can easily design a Gauge chart to show as KPI in SAC story or application.
Thank you for reading the blog. Hope you find this helpful:)
This is excellent. As this chart is not provided by SAP, this blog gives us ability to use this chart by codes shared by you. Thank you, Rakhi !
library(plotly)
library(ggplot2)
fig <- plot_ly(
domain = list(x = c(0,100000), y = c(0,100000)),
value = model$`measure`,
title = list(text=”Title”),
type = “indicator”,
mode = “gauge+number”)
fig <- fig%>%
layout(margin = list(l=20,r=30))
fig
Very well explained! Thank you Rakhi for helping us co-developers with this kind of charts!
Very good informative article.Thanks Rakhi for sharing!
This is pretty good stuff! Thanks for sharing..
Thanks for sharing Rakhi, nice blog
And R visualizations also works with live connectivity. You can see an example with SAP BW/4HANA live data here: https://blogs.sap.com/2020/01/08/analyse-your-data-live-with-sap-analytics-cloud-on-sap-bw-on-hana-sap-bw-4hana/
Cheers
Adem