def generateVisualizerTable(cls, table: TableModel, visio: VisualizationModel) -> TableModel: columns = list() for columnId in visio.usedColumns: if columnId != visio.xColumn: columnIndex = DataController.getElementIndexById( table.columns, columnId) columns.append(table.columns[columnIndex]) returnTable = TableModel(columns, table.name, table.id, table.properties, table.aggregator, table.filters, table.isDeleted) # setting used colors in table: # 1- rows: returnTable.rowsColors = table.rowsColors # 2- columns: columnsColors = list() for columnId in visio.usedColumns: if columnId != visio.xColumn: columnIndex = DataController.getElementIndexById( table.columns, columnId) columnsColors.append(table.columnsColors[columnIndex]) returnTable.columnsColors = columnsColors return returnTable
def _generateTableFromDict(cls, columns: dict, name: str, id: int, randomColumnsColors: List, randomRowsColors: List) -> TableModel: columnIdCounter = 0 bufferColumnsList = [] for columnName in columns.keys(): bufferColumnsList.append(cls._generateColumnFromDict(columns[columnName], columnName, columnIdCounter)) columnIdCounter += 1 properties = PropertiesModel(enums.FileType.Excel.value, 50) aggregator = AggregationModel([], 0, '', False) table = TableModel(bufferColumnsList, name, id, properties, aggregator,[] , False) table.rowsColors = randomRowsColors table.columnsColors = randomColumnsColors return table