analytic Coffee!
  • Topical Tessitura Community Groups
  • More
analytic Coffee!
Wiki Conditionally format the color of text
  • Discussions
  • Files
  • Wiki
  • Members
  • Mentions
  • Tags
  • Events
  • More
  • Cancel
  • New
analytic Coffee! requires membership for participation - click to join
  • analytic Coffee! Wiki
  • +Tessitura Analytics Shared Dashboards
  • +Data Analysis Training Opportunities
  • -Analytics Tips & Trouble shooting
    • Analytics Scripts not Saving
    • Auto-Zoom Scatter Map
    • Changing Labels on a Graph
    • Conditionally format the color of text
    • First Time Buyers and Subsequent Buying
    • Fixing Tessitura Analytic Emails after an upgrade
    • Joining Isolated Data-points, Removing Data Markers, Interpolating Last Point
    • Milestones: Labelled Data Points on Analytics Charts
    • RSUM continuous chart, remove gaps
    • Scatter Map Widget tips - Heat Map of postal codes
    • Sorting First Performance Name by Date Instead of Alphabetically
    • Troubleshoot Data Warehouse Load
    • Troubleshooting Application Availability
  • Jupyter Notebooks
  • Learning about AI
  • +Learning about Python
  • +Power BI & Tessitura

Conditionally format the color of text

NB/ To make these modifications below you'll need to edit your widgets script and add these special scripts in. That guide is HERE

Conditionally format the color of text within a Pivot Table column based on value (JQuery/JavaScript)

From Daniel Gomez https://community.tessituranetwork.com/tessitura_software_forums/f/tessitura_shared_reports-9/24079/analytics-date-time-functions

Here are some examples of using these functions that I threw together quickly.  The secret to using these functions is that you must have a date/time column included in the widget, otherwise, SiSense has nothing to evaluate the functions against. Lots of much fancier ways to present the data you're interested in depending on the visualization that best tells the narrative you are trying to present.

I've also included below a pretty simple script you can use to conditionally format the color of text within a Pivot Table column based on value.

//Text column formatting
widget.on('ready', function(se, ev){

    var evalCol = 4; //fidx val of column to evaluate
    var formatCol = $('td[fidx='+evalCol+']'); //jQuery pull entire eval column into array

    $.each(formatCol, function(a, b){ //function to loop through array
        if($(this).attr('val') > 0) { //evaluate text content of each cell in column's array. note: need to use JavaScript this instead of jQuery $(this), since textContent is a JavaScript attribute.
            $(this).css('color','green'); //set conditional styling
        }
        else if ($(this).attr('val') < 0) {
            $(this).css('color','red');
        }
    });
});


Heath's notes

  • line 3      evaluate column #4 - This is the one to be recolored
  • line 7-9    if the data is more than 0 make it green
  • line 11-12  if the data is less than 0 make it red

7608.ArshtCenter_SiSenseDateTimeFunctionExamples_2019-12-17.dash

  • Tessitura Analytics
  • Javascript
  • jquery
  • conditional format
  • Share
  • History
  • More
  • Cancel
Related
Recommended