def __getSelectedDataItems(self) -> List[List[Any]]:
        """Returns the items based on the selected Spreadsheet cells."""

        selectedCells: List[Tuple[int, int]] = list(sorted(self.__spreadsheet.selectedCells(), key=lambda cell: cell[1]))

        if len(selectedCells) == 0:
            return list()

        columns: List[List[Any]] = list()

        currentColumn: int = selectedCells[0][1]
        column: List[Any] = list()
        for cell in selectedCells:
            if cell[1] > currentColumn:
                currentColumn = cell[1]
                columns.append(column)
                column = list()

            item: Any = self.__spreadsheet.cell(cell[0], cell[1])
            num: float = tryConvertToFloat(item)
            if isNumber(num):
                column.append(num)

        columns.append(column)

        return columns
    def _confirm(self) -> None:
        self.__series.title = self._getTitleFromView()
        self.__series.text = self._getTextFromView()
        self.__series.textPosition = self._getTextPositionFromView()

        minX = tryConvertToFloat(self._getMinXFromView()) or 0
        maxX = tryConvertToFloat(self._getMaxXFromView()) or 0
        minY = tryConvertToFloat(self._getMinYFromView()) or 0
        maxY = tryConvertToFloat(self._getMaxYFromView()) or 0

        alphaStr = self._getAlphaFromView()
        if alphaStr:
            alpha = tryConvertToFloat(alphaStr)
            color = self.__series.color

        self.__series.color = (color[0], color[1], color[2], alpha)

        self.__series.xLimits = (minX, maxX)
        self.__series.yLimits = (minY, maxY)

        self._result = DialogResult.Ok
        self._close()
    def __getSelectedItemsForCoordinate(self, coordinate: str) -> List[Number]:
        """Returns the items for the given coordinate based on the selected Spreadsheet cells."""

        items: List = list()
        for cell in self.__selectedCells[coordinate]:
            item: Any = self.__spreadsheet.cell(cell[0], cell[1])
            if coordinate == "meta":
                items.append(str(item))
                continue

            num: float = tryConvertToFloat(item)
            if isNumber(num):
                items.append(num)
            else:
                items.append(str(item))

        return items
Exemplo n.º 4
0
 def _getMaxYFromView(self) -> float:
     return tryConvertToFloat(self.__maxY.text()) or 0
Exemplo n.º 5
0
 def _getMinXFromView(self) -> float:
     return tryConvertToFloat(self.__minX.text()) or 0
 def _getConfidenceBandFromView(self) -> float:
     return tryConvertToFloat(self.__confidenceBandInput.text())