lib/Models/LegendHelper.js
function getTableColumnStyle(tableColumn, tableStyle) {
  var tableColumnStyle;
  if (defined(tableColumn) && defined(tableStyle.columns)) {
    if (defined(tableStyle.columns[tableColumn.id])) {
      tableColumnStyle = clone(tableStyle.columns[tableColumn.id]);
    } else {
      // Also support column indices as keys into tableStyle.columns
      var tableStructure = tableColumn.parent;
      var columnIndex = tableStructure.columns.indexOf(tableColumn);
      if (defined(tableStyle.columns[columnIndex])) {
        tableColumnStyle = clone(tableStyle.columns[columnIndex]);
      }
    }
  }
  if (!defined(tableColumnStyle)) {
    return tableStyle;
  }
  // Copy defaults from tableStyle too.
  for (var propertyName in tableStyle) {
    if (
      tableStyle.hasOwnProperty(propertyName) &&
      tableColumnStyle.hasOwnProperty(propertyName)
    ) {
      if (!defined(tableColumnStyle[propertyName])) {
        tableColumnStyle[propertyName] = tableStyle[propertyName];
      }
    }
  }
  return tableColumnStyle;
}
function getTableColumnStyle(tableColumn, tableStyle) {
  var tableColumnStyle;
  if (defined(tableColumn) && defined(tableStyle.columns)) {
    if (defined(tableStyle.columns[tableColumn.id])) {
      tableColumnStyle = clone(tableStyle.columns[tableColumn.id]);
    } else {
      // Also support column indices as keys into tableStyle.columns
      var tableStructure = tableColumn.parent;
      var columnIndex = tableStructure.columns.indexOf(tableColumn);
      if (defined(tableStyle.columns[columnIndex])) {
        tableColumnStyle = clone(tableStyle.columns[columnIndex]);
      }
    }
  }
  if (!defined(tableColumnStyle)) {
    return tableStyle;
  }
  // Copy defaults from tableStyle too.
  for (var propertyName in tableStyle) {
    if (
      tableStyle.hasOwnProperty(propertyName) &&
      tableColumnStyle.hasOwnProperty(propertyName)
    ) {
      if (!defined(tableColumnStyle[propertyName])) {
        tableColumnStyle[propertyName] = tableStyle[propertyName];
      }
    }
  }
  return tableColumnStyle;
}
function getTableColumnStyle ( tableColumn , tableStyle ) { var tableColumnStyle ; if ( defined ( tableColumn ) && defined ( tableStyle . columns ) ) { if ( defined ( tableStyle . columns [ tableColumn . id ] ) ) { tableColumnStyle = clone ( tableStyle . columns [ tableColumn . id ] ) ; } else { // Also support column indices as keys into tableStyle.columns var tableStructure = tableColumn . parent ; var columnIndex = tableStructure . columns . indexOf ( tableColumn ) ; if ( defined ( tableStyle . columns [ columnIndex ] ) ) { tableColumnStyle = clone ( tableStyle . columns [ columnIndex ] ) ; } } } if ( ! defined ( tableColumnStyle ) ) { return tableStyle ; } // Copy defaults from tableStyle too. for ( var propertyName in tableStyle ) { if ( tableStyle . hasOwnProperty ( propertyName ) && tableColumnStyle . hasOwnProperty ( propertyName ) ) { if ( ! defined ( tableColumnStyle [ propertyName ] ) ) { tableColumnStyle [ propertyName ] = tableStyle [ propertyName ] ; } } } return tableColumnStyle ; }
Find the right table column style for this column. By default, take styling directly from the tableStyle, unless there is a suitable 'columns' entry.
Find the right table column style for this column . By default take styling directly from the tableStyle unless there is a suitable columns entry .