cancel
Showing results for 
Search instead for 
Did you mean: 

Pivot Table 2: Center The Pivot Inside The Dashboard Widget

MarkZither
7 - Data Storage
7 - Data Storage

Building on the article Pivot Table 1: Center The Pivot Inside The Dashboard Widget (sisense.com) by Vitalii Veremeiev

This script is created to center the Pivot table inside the dashboard widget.

Instead of Pivot Table being anchored to the top left,  you can use this script to make the pivot centered both vertically and horizontally.

Please note, this working only for "Pivot Table widget" with version 2.

Step-by-step guide:

  1. Open a pivot widget in Sisense dashboard and go to 'Edit Script'
  2. Copypaste the below script and press save button
  3. Test the results, see how a Pivot table is centered in your screen
  4. Feel free to modify values in the script "margin-left" and "margin-top" to make the Pivot in the right position
  5. prism.$ngscope.appstate === "dashboard" applies the change on the dashboard view while prism.$ngscope.appstate === "widget" applies the change in the widget editor view which has different markup to change.

 

 

widget.on('ready', function(widget) {
    var widgetContainer = $('[widgetid="' + widget.oid + '"]')
    console.log(prism.$ngscope.appstate);
    if (prism.$ngscope.appstate === "dashboard") {
        $('[widgetid="' + widget.oid + '"]').find(document.getElementsByClassName('pivot-container')).css('margin-left', '25%').css('margin-top', '25%')
    } else if (prism.$ngscope.appstate === "widget") {
        $(document.getElementsByClassName('pivot-container')).css('margin-left', '25%').css('margin-top', '25%')
    }
})

 

 

This is what it looks like

Pivot2 Centred Dashboard ViewPivot2 Centred Dashboard ViewPivot2 Centred Widget ViewPivot2 Centred Widget View

 

0 REPLIES 0