Change Indicator labels to Camel Case
Overview
This code will allow you to change the text formatting for indicators. Currently all labels show up in uppercase, this script allows you to display them in camel-case (capitalize the first letter of each word). In your dashboard, open up the script editor and copy/paste the below code snippet.
dashboard.on('refreshend', function(dash){ // Get all the title/subtitle labels var titles = $('span.title_span'); var subtitles = $('span.secondary_title_span'); // Convert to lowercase var convertToLowerCase = function(){ var lowerText = $(this).text().toLowerCase(); $(this).text(lowerText); } $.each(titles, convertToLowerCase) $.each(subtitles, convertToLowerCase) // change css titles.css('text-transform','capitalize'); subtitles.css('text-transform','capitalize'); })
After copying the script into the editor, click save, and then refresh the dashboard. Your results should look something like this:
-
v6.5 appears to have changed the default formatting of indicator titles from uppercase to Camel Case. Anyone wanting to go back to the old format (without hacking the CSS templates) may want to adapt this script to force uppercase. If this is added to any widget, it applies to all indicators on the dashboard.
/* uppercase indicator titles */
dashboard.on('refreshend', function(dash){
// Get all the title/subtitle labels
var titles = $('span.title_span');
var subtitles = $('span.secondary_title_span');
// change css
titles.css('text-transform','uppercase');
subtitles.css('text-transform','uppercase');
}) -
Any idea how to tell sisense to just leave my labels in the format that I write them in the editor?
Seems stupid to force upper, lower or camel. Just put what I write, and if I don't like it, I can change it!
Update: I used this script to find the screwy formatting and bandaid fix it...just seems like it should be unnecessary.
dashboard.on('refreshend', function(dash){
//find all " Id " in titles and replace with " ID "
var titles = $('span.title_span');
titles.text(function () {
return $(this).text().replace(" Id ", " ID ");
});//make sure the css isn't going to screw up the fix we just implemented.
titles.css('text-transform','none');
});
Please sign in to leave a comment.
Comments
3 comments