Build A Custom Widget in SAP Analytics Cloud, Analytics Application - SAP Blogs
Build A Custom Widget in SAP Analytics Cloud, Analytics Application - SAP Blogs
Community
Follow
Technical Articles
Ferry Djaja
December 6, 2019 | 17 minute read
In this tutorial, we will build a simple custom widget in SAP Analytics Cloud, Analytics
Application to show the gauge chart as shown below.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 1/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 2/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
A custom widgets are implemented as Web Components. The Web Components are
made of HTML, CSS and JavaScript.
Custom Widgets
Custom widget consists of the following files:
Prerequisites
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 3/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
You need a web server that hosts the resources of the custom widget files
(JavaScript files, CSS files, images, and so on). Assume that your web server address
is :
https://example.demo/customwidgets
box.json
Custom Widget JSON of Gauge Box.
box.js
Web Component JavaScript file of the Gauge Box.
box_sps.js
Web Component JavaScript file of the Styling Panel of the Gauge Box.
box_bps.js
Web Component JavaScript file of the Builder Panel of the Gauge Box.
icon.png
Icon of the Gauge Box in any 16×16 pixel icon.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 4/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
The Gauge Box custom widget is composed of the following three Web Components:
The first Web Component is the actual Gauge Box as indicated by the kind of “main”.
The second Web Component is the Styling Panel of the Gauge Box as indicated by
the kind of “styling”. The third Web Component is the Builder Panel of the Gauge Box
as indicated by the kind of “builder”.
Moving on, these are the properties of the Gauge Box custom widget: value, info,
color, width and height.
The property value represents the value in percentage of the Gauge Box. The
property info represents the title of the Gauge Box. The property color represents the
color of the Gauge Box. And the properties width and height represent the initial
width and height of the custom widget.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 5/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
And then the script methods of the Gauge Box are defined:
The function setValue takes three parameters, newValue, newInfo and newColor. The
body property contains the script code which sets the passed all the parameters to
the respective Gauge Box’s properties.
Function getValue takes no parameter and returns the percentage value of the Gauge
Box.
(function() {
let template = document.createElement("template");
template.innerHTML = `
<style>
:host {
border-radius: 10px;
border-width: 2px;
border-color: black;
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 6/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
border-style: solid;
display: block;
}
body {
background: #fff;
}
.metric {
padding: 10%;
}
.metric svg {
max-width: 100%;
}
.metric path {
stroke-width: 75;
stroke: #ecf0f1;
fill: none;
}
.metric text {
font-family: "Lato", "Helvetica Neue", Helvetica, Arial, san
}
.metric.participation path.data-arc {
stroke: #27ae60;
}
.metric.participation text {
fill: #27ae60;
}
</style>
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4">
<div class="metric participation" data-ratio=".95">
<svg viewBox="0 0 1000 500">
<path d="M 950 500 A 450 450 0 0 0 50 500"></path>
<text class='percentage' text-anchor="middle" alig
<text class='title' text-anchor="middle" alignment
</svg>
</div>
</div>
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 7/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
</div>
</div>
`;
this.$style = shadowRoot.querySelector('style');
this.$svg = shadowRoot.querySelector('svg');
this._props = {};
}
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 8/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
onCustomWidgetBeforeUpdate(changedProperties) {
this._props = { ...this._props, ...changedProperties };
}
onCustomWidgetAfterUpdate(changedProperties) {
if ("value" in changedProperties) {
this.$value = changedProperties["value"];
}
if ("info" in changedProperties) {
this.$info = changedProperties["info"];
}
if ("color" in changedProperties) {
this.$color = changedProperties["color"];
}
Constructor
The first function in the JavaScript API is the constructor.
The super() function is called, then the shadow DOM root element is created. The
copy of the template element is added as a child element to the shadow DOM root
element. An element style and svg is selected by using querySelector where
shadowRoot is a reference to the document fragment. Finally, an event listener is
attached to the custom element, listening for click events. Lastly, to make
managing the properties of the Web Component easier, an empty _props object is
initialized.
Handling Custom Widget Updates
In the onCustomWidgetBeforeUpdate() function, the properties in the
changedProperties are merged with the properties of the _props object. The
_props contains the state of all Gauge Box properties before the Gauge Box is
updated.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 10/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
This following code shows the Web Component JavaScript of the Styling Panel
(box_sps.js).
(function() {
let template = document.createElement("template");
template.innerHTML = `
<form id="form">
<fieldset>
<legend>Color Properties</legend>
<table>
<tr>
<td>Color</td>
<td><input id="sps_color" type="text" size="40
</tr>
</table>
<input type="submit" style="display:none;">
</fieldset>
</form>
`;
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 11/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
constructor() {
super();
this._shadowRoot = this.attachShadow({mode: "open"});
this._shadowRoot.appendChild(template.content.cloneNode(tr
this._shadowRoot.getElementById("form").addEventListener("
}
_submit(e) {
e.preventDefault();
this.dispatchEvent(new CustomEvent("propertiesChanged", {
detail: {
properties: {
color: this.color
}
}
}));
}
set color(newColor) {
this._shadowRoot.getElementById("sps_color").value = newCo
}
get color() {
return this._shadowRoot.getElementById("sps_color").value;
}
}
customElements.define("com-demo-box-sps", BoxSps);
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 12/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
This template HTML element is a template for the shadow DOM HTML element that
represents the HTML DOM of the Styling Panel of the Gauge Box.
Constructor
The first function in the JavaScript API is the constructor.
The super() function is called, then the shadow DOM root element is created. The
copy of the template element is added as a child element to the shadow DOM root
element.
Finally, an event listener is attached to form, listening for submit events. If one
such event occurs, the event handler function _submit() is called. Calling bind()
and passing this to _submit() ensures that in _submit() the keyword this
references the custom element.The submit() function is implemented as follows:
The _submit() function calls function preventDefault() on the passed event object,
which prevents submitting the form to the server.
Then, a custom event propertiesChanged is created, indicates a change of
properties to the Custom Widget SDK framework. This custom event contains a
JSON payload which is the color property of the custom widget.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 13/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
The color setter function places a text representation of the new color into the
input field of the Gauge Box’s Styling Panel.
The color getter function returns the text of the input field (color value) of the
Gauge Box’s Styling Panel.
The code is very similar to the Web Components JavaScript of the Styling Panel. The
following code shows the Web Component JavaScript of the Builder Panel
(box_bps.js).
(function() {
let template = document.createElement("template");
template.innerHTML = `
<form id="form">
<fieldset>
<legend>Color Properties</legend>
<table>
<tr>
<td>Color</td>
<td><input id="bps_color" type="text" size="10
</tr>
</table>
<input type="submit" style="display:none;">
</fieldset>
</form>
<style>
:host {
display: block;
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 14/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
_submit(e) {
e.preventDefault();
this.dispatchEvent(new CustomEvent("propertiesChanged", {
detail: {
properties: {
color: this.color
}
}
}));
}
set color(newColor) {
this._shadowRoot.getElementById("bps_color").value = newCo
}
get color() {
return this._shadowRoot.getElementById("bps_color").value;
}
}
customElements.define("com-demo-box-bps", BoxBps);
})();
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 15/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
This template HTML element is a template for the shadow DOM HTML element that
represents the HTML DOM of the Builder Panel of the Gauge Box.
Constructor
The first function in the JavaScript API is the constructor.
The super() function is called, then the shadow DOM root element is created. The
copy of the template element is added as a child element to the shadow DOM root
element.
Finally, an event listener is attached to form, listening for submit events. If one
such event occurs, the event handler function _submit() is called. Calling bind()
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 16/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
and passing this to _submit() ensures that in _submit() the keyword this
references the custom element.The submit() function is implemented as follows:
The _submit() function calls function preventDefault() on the passed event object,
which prevents submitting the form to the server.
Then, a custom event propertiesChanged is created, indicates a change of
properties to the Custom Widget SDK framework. This custom event contains a
JSON payload which is the color property of the custom widget.
Getters and Setters Property
The following code shows the implementation of color setter and getter functions.
The color setter function places a text representation of the new color into the
input field of the Gauge Box’s Builder Panel.
The color getter function returns the text of the input field (color value) of the
Gauge Box’s Builder Panel.
Create a folder called customwidgets and put box.json into that folder.
Create another folder box inside customwidgets folder and put the rest of the files
inside box folder.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 17/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Create a new analytic application. The custom widget is listed in the widget list of
the dropdown menu of the Add menu.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 18/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
The below code illustrates who to define the parameters for the setValue function.
And how to call the getValue function.
ScriptVariable_1 = ScriptVariable_1 + 1;
ScriptVariable_2 = ScriptVariable_2 - 1;
//Set value
Gauge_1.setValue(ScriptVariable_1, "Plus Gauge 1", "#e74c3c");
Gauge_2.setValue(ScriptVariable_2, "Plus Gauge 2", "#3498db");
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 19/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
See it in action:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 20/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 21/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 22/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Highcharts 3D Cylinder:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 23/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 24/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 25/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Clock widget:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 26/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 27/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 28/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 29/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 30/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Compass widget:
Text widget:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 31/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 32/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 33/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
3D scatter widget:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 34/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 35/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 36/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 37/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 38/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 39/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 40/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 41/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 42/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 43/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Google Poly:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 44/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 45/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
A quick demo video to control the SAP Analytics Cloud Custom Widget with web
Bluetooth and micro:bit. User presses the button A and B on micro:bit to fill in and
out the cylinder gauge.
Control two Google Gauges widgets with two micro:bits and Web Bluetooth:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 46/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 47/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 48/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 49/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 50/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 51/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 52/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 53/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
SAPUI5 sap.suite.ui.commons.networkgraph.Graph:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 54/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 55/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 56/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 57/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Covid-19 Widget:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 58/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Zoom Meeting:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 59/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Sankey Diagram:
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 60/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 61/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Reference
SAP Analytics Cloud Custom Widget Developer Guide
Alert Moderator
Assigned Tags
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 62/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
SAPUI5
AmCharts
AnyCharts
Chat Bot
Custom Widgets
View more...
Analyse your data live with SAP Analytics Cloud on SAP BW on HANA & SAP BW/4HANA (Part 1) [Updated March
2023]
By Adem Baykal Jan 08, 2020
Related Questions
Is it possible to convert a story to an analytic application in SAC
By Sebastian Schmoll Nov 20, 2020
62 Comments
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 63/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Praveen singh
December 6, 2019 at 7:09 am
Hi Ferry, Is there a way to include additional javascript libraries into our custom widget json so that I can make
use of them in my component javascript file. It was mentioned in SDK docs that we can include javascript
libraries but the way to include those are not mentioned. Thanks in advance
Like 0 | Share
hi Praveen,
Cheers,
Ferry
Like 1 | Share
Functional Support
January 13, 2020 at 12:40 pm
hi Ferry,
All your Demos look super cool. The Google Gauge demo is exactly what am looking for. I
would be grateful if you can share some further information on how the google library could
be integrated into the custom widget web component. Did you skip the shadow dom
completely? Also, did you try experimenting with Polymer? What build tools do you use?
Thanks in advance!
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 64/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Ramu
Like 0 | Share
hi Ramu,
I am using pure JS and no other libraries. The reason is the loading is faster and the
size is very small. Yes I am using shadow DOM.
https://www.sapanalytics.cloud/product_updates/developer-future/
Cheers,
Ferry
Like 0 | Share
M. Bruins
December 6, 2019 at 1:42 pm
Hi Ferry,
is there any information on how to bind or get data from a model in stead of only feeding data to the custom
widget with scripting functions?
Like 0 | Share
Carlos Suarez
December 9, 2019 at 6:17 pm
It is indeed in the planned innovations for 2020 if I recall correctly. I believe David Stocker mentioned
this during his custom widget hands on session in teched 19.
Like 0 | Share
https://www.sapanalytics.cloud/product_updates/developer-future/
Like 0 | Share
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 65/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Armando Santos
December 18, 2019 at 9:57 am
Hello Ferry
I am trying myself to create my first widget (based on your "com.demo.gauge") but I am struggling with an
issue.
box.json
box\box.js
box\box_bps.js
box\box_sps.js
box\icon.png
into: https://try.gogs.io/armando.j.a.santos/SAPCustomWidget/src/master/box/
but after I upload the custom widget in SAC and add this widget into a new Analytic Application then I get the
below error:
"Something went wrong. The system couldn't load the custom widget 'com.demo.gauge_1.x' (kind: 'main')
for this reason: The system took too long to define the custom widget.'
Can I ask your help? Can you please tell me what I am doing wrong?
Regards
Armando Santos
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 66/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
{
"id": "com.demo.gauge",
"version": "1.0.0",
"name": "Demo Gauge",
"description": "A gauge demo",
"newInstancePrefix": "Gauge",
"icon": "https://try.gogs.io/armando.j.a.santos/SAPCustomWidget/src/master/box/icon.p
"vendor": "Demo",
"eula": "EULA",
"license": "1.0",
"webcomponents": [
{
"kind": "main",
"tag": "com-demo-gauge",
"url": "https://try.gogs.io/armando.j.a.santos/SAPCustomWidget/src/master/box
"integrity": "",
"ignoreIntegrity": true
},
{
"kind": "styling",
"tag": "com-demo-gauge-sps",
"url": "https://try.gogs.io/armando.j.a.santos/SAPCustomWidget/src/master/box
"integrity": "",
"ignoreIntegrity": true
},
{
"kind": "builder",
"tag": "com-demo-box-bps",
"url": "https://try.gogs.io/armando.j.a.santos/SAPCustomWidget/src/master/box
"integrity": "",
"ignoreIntegrity": true
}
],
"properties": {
"value": {
"type": "number",
"description": "Gauge value",
"default": "0"
},
"info": {
"type": "string",
"description": "Gauge info",
"default": ""
},
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 67/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
"color": {
"type": "string",
"description": "Text Color info",
"default": "#3498db"
},
"width": {
"type": "integer",
"default": 100
},
"height": {
"type": "integer",
"default": 100
}
},
"methods": {
"setValue": {
"description": "Sets the Gauge value.",
"parameters": [
{
"name": "newValue",
"type": "number",
"description": "Gauge value"
},
{
"name": "newInfo",
"type": "string",
"description": "Gauge info"
},
{
"name": "newColor",
"type": "string",
"description": "Text Color info"
}
],
"body": "this.value = newValue; this.info = newInfo; this.color = newColor;"
},
"getValue": {
"returnType": "number",
"description": "Returns the Gauge value.",
"body": "return this.value;"
}
},
"events": {
"onClick": {
"description": "Called when the user clicks the Box."
}
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 68/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
}
}
Like 0 | Share
hi Armando,
Can you please check and ensure that SAC can access this URL:
https://try.gogs.io/armando.j.a.santos/SAPCustomWidget/src/master/box/box.js
Maybe you can try to host the codes in Git and see.
Cheers,
Ferry
Like 0 | Share
Armando Santos
December 18, 2019 at 4:16 pm
Hello Ferry
https://github.com/armando-j-a-santos/SAPCustomWidget2/blob/master/coloredbox.json
Regards
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 69/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Armando Santos
Like 0 | Share
Armando Santos
December 18, 2019 at 4:33 pm
Hello Ferry
Let me add into this issue, the fact that all JS files and JSON files are accessible in GitHub without
authentication (public files).
My guess is that something - some kind of configuration, is missing is SAC side. Do I need some extra step in
SAC settings?
Armando Santos
Like 0 | Share
hi Armando,
Can you ignore that error message and click "Run Analytics Application" and check if you can see the
chart ?
Cheers,
Ferry
Like 0 | Share
Armando Santos
December 19, 2019 at 8:23 am
If I run the analytics app then na blank page appears and the error also appears - please see
attached image.
Maybe there is something wrong on the scripting code (JS and JSON files). Do you want me to
send you a copy of my code?
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 70/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
On the other hand, I still believe there is something missing in SAC settings that I am not
aware. Can you please advice?
Kind regards
Armando Santos
Like 0 | Share
Hi Armando,
The code is in Git in this blog. Can you do F12 and see what's the error details ?
Cheers,
Ferry
Like 0 | Share
Armando Santos
December 19, 2019 at 9:31 am
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 71/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Regards
Armando Santos
Like 0 | Share
Like 0 | Share
Armando Santos
December 19, 2019 at 10:38 am
Thanks Ferry.
You are right. I was missing the customElements.define in the builder file -
THANKS!, but even after ignoring the error and if I run the application it still
throws the same error (F12 is showing the same errors as in previous post).
Regards
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 72/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Armando Santos
Like 0 | Share
Hau Ngo
December 19, 2019 at 7:52 pm
I was experiencing the same issue that Armando Santos had described.
However, I ran the application and looked at the console log as you suggested and discovered it was an SSL
issue: https://d.pr/i/egX16s
After applying a free SSL certificate to my domain, updating the URL in the JSON file, and uploading the new
JSON file to my SAP Analytics Cloud tenant ... I am able to use the custom widget for the gauge chart type ?
https://cloud.summerlinanalytics.com/2Nurjl10
I hope this helps anyone else who is trying to use the custom widgets!
Like 0 | Share
Armando Santos
December 20, 2019 at 8:07 am
In your case the error seems to be easier to understand and to fix as well:
"but requested an insecure script 'http://summerlinanalytics.com/customwidgets/gauge/box.js". This
request has been blocked; the content must be served over HTTPS."
But in my example - within JSON file - I am using and HTTPS WEB server:
"https://github.com/armando-j-a-santos/SAPCustomWidget2/blob/master/coloredbox.js"
And after deleting the Widget in SAC, upload the new JSON file to my tenant and use it in SAC application I still
get the same issue.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 73/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Regards
Armando Santos
Like 0 | Share
Armando Santos
December 20, 2019 at 9:14 am
I don't know if it helps or not but in my test application in SAC onInitialization() I have the below code:
//Set value
Gauge_1.setValue(ScriptVariable_1, "Plus Gauge 1", "#e74c3c");
And I can see the Gauge_1 widget icon (please see attached image), so it means the icon.PNG file is being read
from my Web Server GitHub (HTTPS). However I still get the same errors messages as shown in previous
posts.
Regards
Armando Santos
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 74/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Like 0 | Share
Armando Santos
December 20, 2019 at 1:34 pm
@FERRY: One more try from my side! I have just used your JS files (from github) within my JSON file:
"id": "com.demo.gauge",
"version": "1.0.0",
"name": "Demo Gauge",
"description": "A gauge demo",
"newInstancePrefix": "Gauge",
"icon": "https://github.com/ferrygun/SAPCustomWidget/blob/master/box/icon.png",
"vendor": "Demo",
"eula": "EULA",
"license": "1.0",
"webcomponents": [
{
"kind": "main",
"tag": "com-demo-gauge",
"url": "https://github.com/ferrygun/SAPCustomWidget/blob/master/box/box.js",
"integrity": "",
"ignoreIntegrity": true
},
{
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 75/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
"kind": "styling",
"tag": "com-demo-gauge-sps",
"url": "https://github.com/ferrygun/SAPCustomWidget/blob/master/box/box_sps.j
"integrity": "",
"ignoreIntegrity": true
},
{
"kind": "builder",
"tag": "com-demo-box-bps",
"url": "https://github.com/ferrygun/SAPCustomWidget/blob/master/box/box_bps.j
"integrity": "",
"ignoreIntegrity": true
}
],
...
And after deleting the widget in SAC, upload the new JSON file to my tenant and use it in a SAC application I
still get the same the error (the same as mention earlier in the beginning of my post):
Please advice.
Thanks in advance.
Regards
Armando Santos
Like 0 | Share
Charlie Lin
December 24, 2019 at 7:37 am
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 76/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Hello Armando,
I was running the same error with you. And i fixed the issue by changing the GitHub settings. See the
pic below.
Then you will be able to visit the json file by using the URL. If you don't change the setting, the page will
be like 3rd pic.
https://shineshow.github.io/SAC/box/box.js
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 77/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Like 2 | Share
Armando Santos
December 26, 2019 at 9:43 am
Bingo!!!
Regards
Armando Santos
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 78/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Like 0 | Share
Sebastian Preusser
December 30, 2019 at 11:04 am
Hey all,
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 79/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
"id": "com.demo.gauge",
"version": "2.0.0",
"name": "Demo GaugeV2",
"description": "Demo",
"newInstancePrefix": "Gauge",
"icon": "https://sebastian684.github.io/SAPCustomWidget/box/icon.png",
"vendor": "Demo",
"eula": "EULA",
"license": "1.0",
"webcomponents": [
{
"kind": "main",
"tag": "com-demo-gauge",
"url": "https://sebastian684.github.io/SAPCustomWidget/box/box.js",
"integrity": "",
"ignoreIntegrity": true
},
{
"kind": "styling",
"tag": "com-demo-gauge-sps",
"url": "https://sebastian684.github.io/SAPCustomWidget/box/box_sps.js",
"integrity": "",
"ignoreIntegrity": true
},
{
"kind": "builder",
"tag": "com-demo-box-bps",
"url": "https://sebastian684.github.io/SAPCustomWidget/box/box_bps.js",
"integrity": "",
"ignoreIntegrity": true
}
],
Any ideas?
Thanks,
Sebastian
Like 0 | Share
Functional Support
January 13, 2020 at 4:45 pm
hi Sebastian,
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 80/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
You have used the tag "com-demo-gauge-sps" in the JSON file, however in the box_sps.js has the tag
defined as "com-demo-box-sps". that is why the error.
Like 0 | Share
Andrew Barlow
August 18, 2021 at 2:37 pm
Hi Sebastian,
Looking at the styles js file (box_sps.js) if you compare it with the builder js file (box_bps.js) it has
some brackets missing from the end.
I was experiencing the same issue but by adding })(); to the end of the styles js file (box_sps.js) all
works for me now without any error.
Like 0 | Share
qingqing ji
January 7, 2020 at 6:43 am
Hello,Ferry.
Can you share souce file for the demo Google Gauge?
Thanks.
Like 0 | Share
Hi Ji,
I am afraid not able to share the code in this blog. Please ping me if you are interested.
Regards,
Ferry
Like 0 | Share
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 81/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Hello Ferry
Thank.
Like 0 | Share
Semih Baysal
January 7, 2020 at 10:20 am
Hi Ferry,
Thanks.
Like 0 | Share
Hi Semih,
Regards,
Ferry
Like 0 | Share
Arijit Das
January 14, 2020 at 9:45 am
Can anyone please explain the meaning of the following code snippet:
onCustomWidgetBeforeUpdate(changedProperties) {
this._props = { ...this._props, ...changedProperties };
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 82/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Thanks
Arijit
Like 0 | Share
Hi Arijit,
Regards,
Ferry
Like 0 | Share
Arijit Das
January 21, 2020 at 4:30 am
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 83/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Hi Ferry,
Can we use webcomponents built with polymer framework to create custom widget in SAC? If yes, could you
please share one simple example?
Or, can we use third party js libraries like JQuery / D3 to create the custom widget? How to include those
libraries and how to manipulate DOM elements inside shadow root using Jquery/D3?
Thanks,
Arijit
Like 0 | Share
Hi Arijit
Yes you can blend it with the existing JavaScript libraries. Most of the examples I built, I am basing on
the existing libraries and not building it from the scratch.
Maybe I will post another blog on how to create a simple WebComponents and blend it with the
external JS libraries like Amcharts.com once I have time. To put in this write up alone, it will be very
long and messy.
Cheers,
Ferry
Like 0 | Share
Arijit Das
January 21, 2020 at 12:41 pm
Thanks Ferry for the hint. Now I am able to use third party JS libraries for the custom widget.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 84/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Like 0 | Share
welcome. I am just posted the use of external lib amCharts with the widget in SAC. Here is a quick
video: https://youtu.be/CenR8D75nk8
Like 0 | Share
VR Sunkara
February 7, 2020 at 1:20 am
Hey Ferry,
All your demos look amazing. We are really struggling with building custom JS widgets using
3rd party libraries. I would greatly appreciate if you can give some pointers for the below
questions:
1. How did you manage to import external libraries into the web component? Any code
snippets or tutorial links would help.
2. In most of your demos, you were able to consume data from SAC model. Could you
please give some hints on how to bind data into a custom widget? As per the SAP
documentation, the input data types of the methods and parameters support only 1
dimensional arrays, how can we pass table like data into the custom widget?
Any simple code snippets which shows the above concepts will really help with our POC. Am
looking forward for your blog on Amcharts integrations.
Thanks in advance!
Venkat
Like 0 | Share
Sungyoul Baik
February 20, 2020 at 12:35 am
Dear Ferry,
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 85/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
The tutorial works perfect for me. Thank you a lot. I also like the examples you made!
I'm trying you implement 3rd part chart library on the custom widget just like you did, but I have no clue how to
embed the chart libraries into the custom widget files. I know you are about to write a blog about it but can you
share a sample code please?
Many thanks.
Like 0 | Share
Hi Sungyoul,
Cheers,
Ferry
Like 1 | Share
Sevim Eraslan
March 3, 2020 at 4:01 pm
Hi Ferry,
I also wanted to test your files in SAP Analytics Cloud. The following error message occu
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 86/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Best regards
Sevim
Like 0 | Share
Oguz Kose
March 6, 2020 at 7:54 am
"properties": {
"value": {
"type": "integer",
"description": "Gauge value",
"default": 0
},
Its looking like that now. You can try this method.
Like 1 | Share
Fabio Sist
April 20, 2020 at 7:52 am
Hi Ferry,
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 87/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
is there a way to modify the Gauge box properties inside the box.js? Let's say I'd like to change the color
property based on the value of the gauge, is it possible to do it on widget side (box.js) instead of managing it on
Analytic Designer side?
Note that I'd like to change the propery in the way that the getter method will give me the new value modified
in the box.js.
Fabio
Like 0 | Share
Aleksey Salinin
May 19, 2020 at 8:40 am
have u any instructions or step-by-step on how to embed m.components in App with CW? For example,
DateTime.Picker or KPI.Tiles (like in your youtube videos)?
Like 0 | Share
hi Aleksey Salinin
Regards,
Ferry Djaja
Like 2 | Share
Huimin Li
July 21, 2020 at 2:46 pm
Thank you so much Ferry, all the blogs you posted about custom widget on SAC is so helpful!!
Like 0 | Share
Hi Aleksey Salinin
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 88/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
You can check my new blog here on how to use SAPUI5 elements in SAP Analytics Cloud Custom
WIdget.
https://blogs.sap.com/2020/06/02/add-and-use-sapui5-elements-in-sap-analytics-cloud-custom-
widget
Regards,
Ferry Djaja
Like 1 | Share
Surya Dharma
June 10, 2020 at 6:36 am
Do you have customise trend indicator arrow tutorial for analytics design, maybe? that will show the arrow
trend if the value below 3% (or absolute number) the arrow will be red, more than 3% will green and in
between will show a deep yellow colour with a horizontal arrow shape. Thanks in advance for any advice!
Regards,
Surya Dharma
Like 0 | Share
Terima kasih.
If using custom widget, we can define all those parameters in the styling or builder panel. I think is
easy to achieve it. I don't have that tutorial yet at this moment. I will find some time to write it.
Regards,
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 89/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Ferry Djaja
Like 0 | Share
Surya Dharma
June 12, 2020 at 6:54 am
That would be great, Ferry! really appreciate if you can share the techniques. But maybe I
describe it clear what I want to achieve.
So I'm goint to build a dashboard and might be use the structure as template structure. I need
to build this in analytics designer mode (not story). The source is queries with live-connection.
This dashboard have 40+ (numeric chart) KPI's. Build with 6 Panel. On initial the first three
panels appears and switch to another panel with radiobutton (this is done). Each Panel
contain four KPI's. On init the indicator should read each KPI value and show correspondent
arrow trend indicator (this is still homework). Later on I will build dropdown for year, month,
week, etc filter.
How I've done so far. I added three different gif images (green, red, yellow) on each KPI's. So,
here are 40+ KPI's multiply by three. It's a lot small images placed by the KPI side-by-side. I
have two global variable, one to control image, and the other one to control the value. I created
global script for expected condition (>3%, below and in between). Still the result not really
working as my expectation.
I don't find another solution so far, like using "Form" (circle shape) and controll the colour
pallete through script (like ".setColor function). Well the setColor function is not available and
furthermore there is only "onClick" event with "shape" instead of something like
"onResultChanged".
Appreciate a lot if you can share or have any method to create less-complex trend arrow
indicator. Terima kasih!
Regards,
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 90/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Surya Dharma
Like 0 | Share
Hi Surya,
Regards,
Ferry Djaja
Like 0 | Share
Roopa Puranik
September 24, 2020 at 9:39 pm
Hi Ferry,
I was researching and came across your article. I am trying to see if I can create a custom widget to reset story
in SAC and use the rest button widget in the dashboard. Is that doable. If so, what is the code and if you can
provide details on how to accomplish this, that would be great? Our users hate the reset icon that is available
on the toolbar and its not very visible. They all have been asking for the reset button to be added to the
dashboard on all tabs. We have a big demo coming u next week and want to impress our execs, so any help
would be greatly appreciated.
Thank you
Roopa
P.S. I have an idea submitted for this in the idea place already to highlight the reset button and call it reset.
Like 0 | Share
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 91/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Ferry Djaja | Blog Post Author
September 25, 2020 at 12:51 am
hi Roopa,
Can you let me know what is the reset function in SAC story ?
Regards,
Ferry
Like 0 | Share
Roopa Puranik
September 25, 2020 at 2:43 pm
Hi Ferry,
To Reset all the filters on the story or on the tab where the widget is added. Same as the Reset
button on the toolbar in SAC stories.
This will be a life saver until SAP enhances the current reset icon.
Roopa
Like 0 | Share
hi Roopa,
I am not sure if there is any API for reset function in SAC Analytic Application. If there
is, we can create a widget for that purpose.
Regards,
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 92/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Ferry
Like 0 | Share
Roopa Puranik
September 28, 2020 at 6:28 pm
Okay Thank you. I don't know a whole lot about JAVA scripting but was hoping
we could accomplish this by creating a custom widget and use it in SAC
stories.
Like 0 | Share
Martino Rivaplata
February 20, 2021 at 12:19 am
Hi Ferry,
I have an SAC analytic application in which I have a button on it. I would like for the button onClick event to
trigger refreshing the https:// URL page of the Analytic Application. When you have the chance if you have any
ideas please let me know. Attached is an screenshot of the analytic application. Please let me know any
questions. Thank You!
Like 0 | Share
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 93/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Roopa Puranik
March 19, 2021 at 7:42 pm
Hello Ferry,
Do you know if it's possible to setup a story page with carousel style page (slider/slideshow) using application
designer? Can you please share some insights on this.
Thank you
Roopa
Like 0 | Share
Maxime Gillet
July 19, 2021 at 9:24 am
Hello ,
Is there a secure way to handle credentials? I mean if the button is doing an http request on a protected url,
how should it be done?
Thanks
Like 0 | Share
Francesco Allocca
November 23, 2021 at 12:53 pm
Hi Ferry,
If we would modify the chart to have a range between -100% to 100%? And not 0% to 100%.
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 94/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
Thanks
Francesco
Like 0 | Share
Lilu Zhang
September 21, 2022 at 9:18 pm
Hi Ferry,
Thanks for the knowledge sharing through this great blog! I have a client, they have a scenario will be benefit
from the custom widget DatePicker. It works great, it's just seems we do not have a method to clear the
selection to make the widget back to it's initial state which with the recommendation of the format. Is there a
way to set the DatePicker widget to it's initial state through the Analytics Designer or there a way to enhance
the custom widget to add a clear method?
We tried to define a Date type variable and pass it to widget through setDateVal() method, however, we cannot
pass a null value into it.
Lilu.
Like 0 | Share
Alfonso Moreno
December 16, 2022 at 4:50 pm
Hi Ferry
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 95/96
1/3/24, 8:02 PM Build a Custom Widget in SAP Analytics Cloud, Analytics Application | SAP Blogs
I want to create the barcode, however I am not a developer, because when I want to load the json or js files I
have no idea if I am doing it correctly or not.
Thanks in advance for any help and advice you could give me.
Regards!!!!
Like 0 | Share
Find us on
Newsletter Support
https://blogs.sap.com/2019/12/06/build-a-custom-widget-in-sap-analytics-cloud-analytics-application/ 96/96