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
Beispiel #2
0
 def sugreCoatAggregatedTable(cls, table: TableModel) -> TableModel:
     if table.aggregator.isActive:
         table.columns.clear()
         table.columns.extend(table.aggregator.aggregatedTable)
         table.rowsColors = table.rowsColors[:len(table.columns[0].cells) - 1]
         table.rowsVisibility = table.rowsVisibility[:len(table.columns[0].cells) - 1]
         return table
     else:
         return table
Beispiel #3
0
    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