Exemplo n.º 1
0
    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
Exemplo n.º 2
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
Exemplo n.º 3
0
style3 = ColumnStyleModel('#DBD56E', 1.0, 1.0, 'Calibri')

column1 = ColumnModel(cells1, str(cells1[0].value), 0, style1, False)
column2 = ColumnModel(cells2, str(cells2[0].value), 1, style2, False)
column3 = ColumnModel(cells3, str(cells3[0].value), 2, style3, False)

columns = [column1, column2, column3]

#=================================================================================================================
#=================================================================================================================

properties = PropertiesModel(enums.FileType.DataI.value, 50)

aggregator = AggregationModel([], 0, False)

dataSource = TableModel(columns, 'Table1', 0, properties, aggregator, False)

#Adding a column:
#=================================================================================================================
#=================================================================================================================

newCells = [
    CellModel('الوزن', enums.CellType.string.value),
    CellModel(10, enums.CellType.numeric.value),
    CellModel(17, enums.CellType.numeric.value),
    CellModel(55, enums.CellType.numeric.value),
    CellModel(39, enums.CellType.numeric.value),
    CellModel(71, enums.CellType.numeric.value),
    CellModel(66, enums.CellType.numeric.value),
    CellModel(55, enums.CellType.numeric.value),
    CellModel(21, enums.CellType.numeric.value),