Skip to content

Commit

Permalink
Try #167 (oops)
Browse files Browse the repository at this point in the history
  • Loading branch information
tieugene committed Oct 27, 2022
1 parent e8b932c commit 6077bc2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions iosc/sig/widget/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from PyQt5.QtCore import Qt, QMargins, QObject
from PyQt5.QtGui import QResizeEvent, QMouseEvent, QBrush, QColor, QFont, QPen
from PyQt5.QtWidgets import QScrollArea, QLabel, QWidget
from QCustomPlot2 import QCustomPlot, QCPScatterStyle, QCPItemText, QCPGraphData, QCPGraph, QCPRange
from QCustomPlot2 import QCustomPlot, QCPScatterStyle, QCPItemText, QCPGraphData, QCPGraph, QCPRange, QCPPainter
# 3. local
import iosc.const
from iosc.core import mycomtrade
Expand Down Expand Up @@ -354,6 +354,13 @@ def __init__(self, num: int, point: QCPGraphData, parent: QCustomPlot):
self.setText(str(num))
self.position.setCoords(point.key, point.value)

class DigitScatterStyle(QCPScatterStyle):
def __init__(self):
super().__init__(QCPScatterStyle.ssCircle)
# def drawShape(self, painter: QCPPainter, *__args): # not works
# print(len(__args))
# super().drawShape(painter, *__args)

_signal: mycomtrade.AnalogSignal
_sibling: AnalogSignalLabel
__scat_style: EScatter
Expand Down Expand Up @@ -398,10 +405,12 @@ def refresh_scatter(self, scat_style: EScatter) -> bool:
if self.__scat_style != scat_style:
if scat_style < EScatter.P:
shape = QCPScatterStyle(QCPScatterStyle.ssNone)
else:
elif scat_style < EScatter.D:
shape = QCPScatterStyle(QCPScatterStyle.ssPlus)
self._graph.setScatterStyle(QCPScatterStyle(shape))
# <dirtyhack> # TODO:
else:
shape = self.DigitScatterStyle()
self._graph.setScatterStyle(shape)
# <dirtyhack>
'''
if self.__pps < iosc.const.X_SCATTER_NUM <= pps:
# self.graph().setScatterStyle(self.__myscatter)
Expand Down

0 comments on commit 6077bc2

Please sign in to comment.