top of page

Search Results

95 items found for ""

  • Enable shared tooltip in Sisense (display all 'breakby' items in tooltip)

    If a 'breakby' column is added in Sisense widget, currently it shows value of one item at a time in tooltip. Here is a solution to display values of all 'breakby' items in tooltip widget.on('processresult', function(se, ev){ ev.result.tooltip.shared = true ev.result.tooltip.enabled = true }) widget.on("beforedatapointtooltip", function (se, args){ args.cancel=true; });

  • Add button to Sisense widget

    Below script allow you to add a button in Sisense widget and specified URL will be opened when you click on it widget.on("ready", function(w, args){ w.chart[0][Object.keys(w.chart[0])[0]].hc.renderer.button('Open', 10, 10) .attr({ zIndex : 10, height: 15, width: 50, 'text-align': 'center' }) .on('click', function() { window.open('https://www.clickdimensions.com/links/TestPDFfile.pdf') //url of website or document }) .add(); });

  • Python Script to export a Sisense widget to CSV

    Here is the python script to export your Sisense widget to csv. Update the following variables in the script: localpath: Folder to which CSV file need to download server Name: Name of server where Sisense is installed (first part of your dashboard URL) username: Username(email) that you are using to login to Sisense. password: Password to login your account dashboardid: Id of dashboard where widget can be found widgetid: Id of widget from where CSV need to downlead import json import requests import urllib . parse localpath = 'C:\Sisense\CSV_Files \\ ' server_name = 'https://xxxxxx.xxxxxxxxxx.com' username = 'enter sisense login name (email)' password = 'enter your password here' dashboardid = 'dashboard id' widgetid = 'widget id' login_url = server_name + '/api/v1/authentication/login' dash_export_base_url = server_name + '/api/v1/dashboards/export?dashboardIds=' login_data = { 'username' : username , 'password' : password } # Generating token login_res = requests . post ( url = login_url , data = login_data ). json () access_token = login_res .get( 'access_token' ) if len ( access_token ) > 0 : print ( 'login successful' ) api_header = { 'Authorization' : 'Bearer ' + access_token , 'content-type' : "multipart/form-data; boundary= {} " } # Get widget details get_widget_url = server_name + '/api/v1/dashboards/' + dashboardid + '/widgets/' + widgetid get_widget_res = requests . get ( url = get_widget_url , headers = api_header ). json () widget_json = {} widget_metadata = [] widget_json [ "datasource" ] = get_widget_res .get( "datasource" ) panels = get_widget_res .get( "metadata" ).get( "panels" ) #Add metadata from widget for panel in panels : items = panel .get( "items" ) for item in items : if ( not item .get( "disabled" ) == True ): if ( panel .get( "name" ) == "filters" ): widget_metadata . append ({ "jaql" : item .get( "jaql" ), "panel" : "scope" }) else : widget_metadata . append ({ "jaql" : item .get( "jaql" )}) dash_filter_ignore = get_widget_res .get( "metadata" ).get( "ignore" ) ignore_list = dash_filter_ignore .get( "dimensions" ) #Add dashboard filters if ( dash_filter_ignore .get( "all" ) == False ): dash_file = requests . get ( url = dash_export_base_url + dashboardid , headers = api_header , allow_redirects = True ). json () dash_filters = dash_file [ 0 ].get( "filters" ) for dash_filter in dash_filters : if ( not dash_filter .get( "disabled" ) == True and not dash_filter .get( "jaql" ).get( "dim" ) in ignore_list ): widget_metadata . append ({ "jaql" : dash_filter .get( "jaql" ), "panel" : "scope" }) widget_json [ "metadata" ] = widget_metadata widget_json [ "format" ] = "csv" widget_json [ "widgetType" ] = "pivot2" widget_json [ "by" ] = "export" widget_json [ "isMaskedResponse" ] = "true" widget_json [ "filename" ] = "widget.csv" widget_json [ "download" ] = "true" widget_json [ "widget" ] = widgetid widget_json [ "dashboard" ] = dashboardid widget_json [ "culture" ] = "en-US" # Calling API to download CSV datasource = urllib . parse . quote ( get_widget_res .get( 'datasource' ).get( 'title' )) download_csv_url = server_name + '/api/datasources/' + datasource + '/jaql/csv?data=' + urllib . parse . quote ( json . dumps ( widget_json )) donwloaded_csv = requests . post ( url = download_csv_url , headers = api_header , allow_redirects = True ) open ( localpath + widgetid + '.csv' , 'wb' ). write ( donwloaded_csv . content ) print ( 'CSV downloaded' ) requests . get ( server_name + '/api/v1/authentication/logout' )

  • Change background and font color of widgets in Sisense

    Supported widget types : Line chart, Bar chart, Column chart, Pie chart, Scatter chart, Area chart widget.on('processresult',function(se,args){ args.result.chart.backgroundColor = '#656769' //background color args.result.xAxis.labels.style.color = '#ffffff' //x-axis font color args.result.yAxis[0].labels.style.color = '#ffffff' //y-axis font color })

  • Align Pivot 2 to center of Sisense widget container

    Below dashboard script will align Pivot2 to center of widget container dashboard.on('widgetready', function (se, args) { //widgetid of pivot widgetid = '85c345hj7845560080c9g148' if(args.widget.oid == widgetid) { var pivotWidth = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container .multi-grid .pivot-scroller .table-grid .table-grid__table', element).width()) var pivotHeight = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container .multi-grid .pivot-scroller .table-grid .table-grid__table', element).height()) var containerWidth = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).width()) var containerHeight = parseFloat($('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).height()) if(pivotWidth < containerWidth) $('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).css('margin-left', 'calc(50% - ' + (pivotWidth/2) + 'px)') if(pivotHeight < containerHeight) $('[widgetid=' + widgetid + '] pivot2 .pivot-container', element).css('margin-top', ((containerHeight/2) - (pivotHeight/2)) + 'px') } });

  • Change position and color of legend items in Sisense

    Sometimes we may need to move an item (or items) in legend to a specific position, for example moving 'N\A', 'Unknown', 'Not available' etc to the end of list. We can achieve this using below script. Supported widget types : Bar chart, Line chart, Column Chart, Area Chart, Pie Chart widget.on('processresult', function(se, args){ var itemList = [{"name":"Unknown", "position":-1, "color":"grey"}] $.each(itemList, function(index, item){ var old_index $.each(args.result.series, function(index, value){ if(value.name.toUpperCase() == item.name.toUpperCase()) { value.color = ((item.color == '' || !item.color) ? value.color : item.color) old_index = index } }) moveItem(args.result.series, old_index, item.position) }) //Function to move an item at old_index to new_index function moveItem(array, old_index, new_index) { while (old_index < 0) { old_index += array.length; } while (new_index < 0) { new_index += array.length; } array.splice(new_index, 0, array.splice(old_index, 1)[0]); } }) Here itemList is the variable where we specify item, position and its color. name : Name of item in legend position : Index where we need to move the item (new position). 0 - Move item to first position 1 - Move item to 2nd position -1 - Move item to last position color : Color of legend. This is an optional parameter. We can add multiple items in itemList Example: var itemList = [{"name":"South", "position":0, "color":"Green"}, {"name":"West", "position":1, "color":"Blue"}, {"name":"Unknown", "position":-1, "color":"grey"}] Result:

  • Apply different colors for each bars in Sisense

    There is an in-built feature in Sisense to set colors for bars based on its values. Also its possible to set colors if there is a column added in 'Break by' panel. Below script enable us to apply different colors for each bar based on category name. var colorList = { 'Name1': '#d46c3f', 'Name2': '#88b830', 'Name3': '#3071b8', 'Name4': '#7a30b8', 'Name5': '#b83086' } widget.on('processresult',function(se,args){ $.each(args.result.series[0].data, function(i, v){ v.color = colorList[v.selectionData[0]] }) })

  • Add target/benchmark line to a chart in Sisense

    Below script allow us to plot a static target line in a chart. Supported chart types : Bar chart, Column chart, Line chart, Area chart widget.on('processresult', function(se, ev){ ev.result.yAxis[0].plotLines = [{ color: '#2ec7b5', dashStyle: 'LongDash', width: 4, value: 800, zIndex: 5, label : { text : 'Target' } }] }) Possible values of dashStyle are : 'Solid', 'ShortDash', 'ShortDot', 'ShortDashDot', 'ShortDashDotDot', 'Dot', 'Dash', 'LongDash', 'DashDot', 'LongDashDot', 'LongDashDotDot'

  • Apply conditional colors to Markers in Sisense Line chart

    Yes! Its possible to apply different colors to line chart markers based on its value. Here is the script for this widget.on('processresult', function(se, ev){ $.each(ev.result.series[0].data, function(index, value){ if(value.y <= 5000){ value.marker.lineColor = '#206902' value.color = '#206902' value.marker.states.hover.lineColor = '#206902' value.marker.states.select.lineColor = '#206902' } else if(value.y <= 10000){ value.marker.lineColor = '#56c229' value.color = '#56c229' value.marker.states.hover.lineColor = '#56c229' value.marker.states.select.lineColor = '#56c229' } else if(value.y <= 15000){ value.marker.lineColor = '#5cfa19' value.color = '#5cfa19' value.marker.states.hover.lineColor = '#5cfa19' value.marker.states.select.lineColor = '#5cfa19' } else if(value.y <= 20000){ value.marker.lineColor = '#ff4f4f' value.color = '#ff4f4f' value.marker.states.hover.lineColor = '#ff4f4f' value.marker.states.select.lineColor = '#ff4f4f' } else{ value.marker.lineColor = '#ed2b34' value.color = '#ed2b34' value.marker.states.hover.lineColor = '#ed2b34' value.marker.states.select.lineColor = '#ed2b34' } }) })

  • Add bands to Line Chart in Sisense

    There can be scenarios where we need to understand in which level/band the value or category belongs to and the analysis will be easier if there is an option to add bands to the widget. We can achieve this by adding below widget script widget.on('ready', function(se, ev){ $('svg .highcharts-plot-bands-labels-0', element).insertAfter('svg .highcharts-plot-bands-0', element) }) widget.on('processresult', function(se, ev){ ev.result.yAxis[0].plotBands = [{ from:0, to:2500, color:'#9ffff6', label: { text: 'Low', style: { color: '#888a89' } } }, { from:2501, to:5000, color:'#daf1ce', label: { text: 'Medium', style: { color: '#888a89' } } }, { from:5001, to:7500, color:'#fff2c6', label: { text: 'High-1', style: { color: '#888a89' } } }, { from:7501, to:15000, color:'#fcd9e2', label: { text: 'High-2', style: { color: '#888a89' } } }, { from:15000, to:25000, color:'#f6cde3', label: { text: 'High-3', style: { color: '#888a89' } } }] }) (Update from , to , color and text based on your requirement)

  • Hide widget from PDF in Sisense

    This dashboard script hide a specific widget row when exporting to PDF. dashboard.on('widgetready', function (se, ev) { //widgetid to hide from PDF widgetid = '3aecd1801eafb16865d4c87lre' if(ev.widget.oid == widgetid) { $('[widgetid=' + widgetid + ']').closest('.u-r').height(0) } }); Note : This script will hide widget from PDF only, not from email reports.

bottom of page