The Smart Label
Download: Smart Label
Introduction
The following article describes steps needed to add to create smart text widget to present ElastiCube fields as text.
For example - present the selected Country on the upper part of the dashboard:
Implementaion Steps
-
Extract the folder in the attached zip file into \...\Sisense\PrismWeb\plugins. If you are using version 7.2 and higher unzip the contents into your C:\Program Files\Sisense\app\plugins\ folder.
-
Create new widget and chose the smart label icon from the list:
-
Choose a field to present, set a design and hit "Apply":
[Please note, that in case you have multiple values, it will present the first one. Therefore, it is always better to change the type of the filter to single value only, like in the given example]
*****UPDATE October 30th, 2015: Script now supports more than one column in the "Rows" category displaying the contents as a list *****
*****UPDATE March 25th, 2016: Updated to support display of multiple rows AND multiple selection on the filters *****
*****UPDATE April 27th, 2016: Updated to display "All" when there is no filter selection, instead of listing out every member *****
*****UPDATE May 13th, 2016: Updated the script to resolve an issue of a "None" text displayed instead of the value****
*****UPDATE June 2nd, 2016: Updated the script to resolve an issue with date formatting not being passed through, as well as an issue with NOT filters****
*****UPDATE July 5th, 2016: Updated to work with Sisense v6.4
*****UPDATE Aug 15th, 2016: Plugin updated with minor issues fixes
*****UPDATE Feb 3rd, 2017: Plugin updated to work with dependent filters
*****UPDATE Mar 8th, 2017: Plugin updated to work with widget filter. Design options for Labels and Multiple Values work as expected.
*****UPDATE May 23rd, 2017: Plugin updated to work with dependent filters.
*****UPDATE June 12th, 2017: Plugin updated to work on 6.6.1 and support back compatibility with previous versions of the plugin.
*****UPDATE August 13th, 2018: Plugin updated: Widget's style menu offers background and text colors, as well as vertical alignment.
Download previous version from March 8th, 2017
-
Official comment
This plug in works on Version: L8.0.5.156. Only drop the plug in folder contained in the download folder into the plug ins folder in Sisense.
Comment actions -
Hi Stefan.... Try the following code
widget.on('ready', function(se, ev){
$(element).css('background-color','#CE1127');//changes the widget's background
$(element).css('color','white'); //text color
$(element).css('font-weight','bold'); //font style
$('widget-header' ,element.parent()).css('background-color','#CE1127'); //changes the widget's title background
}) -
Is it possible to format dates through custom javascript? It seems that the date formatting option doesn't work with this plugin.
sisense_smartlabel_format.png -
The latest version doesn't work for us in 6.2.0.336 either. We just get a blank widget.
Chrome error console shows the following:
common.js?g=gocoAodcg:47 error refreshing widget: 'Respondent'. (inner exception: TypeError: Cannot read property 'dim' of undefined) - TypeError: Cannot read property 'dim' of undefined
at .<anonymous> (http://p2-sisense-c001:8081/plugins/main.js:3468:29)
at Function.ce.extend.each (http://p2-sisense-c001:8081/js/common.js?g=gocoAodcg:34:13423)
at addFilters (http://p2-sisense-c001:8081/plugins/main.js:3465:7)
at Object.prism.registerWidget.data.buildQuery (http://p2-sisense-c001:8081/plugins/main.js:3539:4)
at buildWidgetQuery (http://p2-sisense-c001:8081/js/app-main.js?g=gocoAodcg:177:9081)
at execute (http://p2-sisense-c001:8081/js/app-main.js?g=gocoAodcg:177:9905)
at http://p2-sisense-c001:8081/js/app-main.js?g=gocoAodcg:6:6529
at Object.o [as forEach] (http://p2-sisense-c001:8081/js/common.js?g=gocoAodcg:6:788)
at refresh (http://p2-sisense-c001:8081/js/app-main.js?g=gocoAodcg:6:6495) -
I've updated the render method so it works, not sure if this is the right way or not:
var style = e.widget.style ? e.widget.style : e.widget.$$model.style;
$lmnt.empty();
$lmnt.append( "<div style='padding:10px;font-size:" + style.size + "' align='"+ style.halign + "'>" + res + "</div>" ); -
When you select more than one value, only the first one appears in the Smart Label. Let's say that my dashboard filter is the Country and I allow the user to select more than one country at a time. If I select for example Canada and United States, the Smart Label only displays Canada. It can be confusing for the user. Is that supposed to work this way?
-
How to resize widget's height of smart label on mobile?
294917.jpg
Please sign in to leave a comment.
Comments
109 comments