This article describes how to go from a Visualization showing all age groups and NETs alongside each other...
...to a Visualization with additional empty columns between age groups and NETs.
Requirements
A table.
Method
1. Select the Visualization or the table used as the Data Source.
2. In the Object Inspector, go to Data > Rules.
3. To apply the rule, select the Plus (+) > New Custom Rule (write your own JavaScript).
4. Select Edit JavaScript.
5. Update and paste the code below.
Notes:
List columns/rows you want to add an empty column after in the second row of the code.
For the Visualization to work, the names of rows and columns must be unique.
Row five of the code specifies the column names using non-visible Unicode characters. To add additional columns, you must add to row five of the code; e.g., to add a third column, include "\u2003"; to add a fourth column, include "\u2004".
To add Empty Columns:
//list columns you want blank column after (first column = 0)
var insertafter=[2,6];
//list column names; use \u2001
var names = ["\u2001", "\u2002"];
//loop through each columns you want to insert
for (numinsert = 0; numinsert < insertafter.length; numinsert ++){
ia=insertafter[numinsert];
br=ia+1;
//loop through each row and make it blank
table.insertColumnAfter(ia, names[numinsert]);
for (var row = 0; row < table.numberRows; row++){
table.blankCell(row, br); }
}
To add Empty Rows:
//list rows you want blank column after (first column = 0)
var insertafter=[2,6];
//list row names; use \u2001
var names = ["\u2001", "\u2002"];
//loop through each row you want to insert
for (numinsert = 0; numinsert < insertafter.length; numinsert ++){
ia=insertafter[numinsert];
br=ia+1;
//loop through each column in the row and make it blank
table.insertRowAfter(ia,' ');
for (var col = 0; col < table.numberColumns; col++){
table.blankCell(br, col);
}
}
6. Click OK.