Улучшить две шкалы, навигацию и формулы графиков
This commit is contained in:
@@ -336,11 +336,13 @@ class PlotProcessingAttachment(QObject):
|
||||
self._dirty = True
|
||||
self._refresh_timer.start(0)
|
||||
|
||||
def formula_entries(self, x, origin=0., unit=''):
|
||||
def formula_entries(self, x, origin=0., unit='', window=None):
|
||||
from set_devices.plot_formula import window_piece
|
||||
entries = []
|
||||
offset = self._external_offset if self._external_curve is not None else 0.
|
||||
for curve in self.curves:
|
||||
piece = curve.piece_at(x + offset)
|
||||
piece = (window_piece(curve, x + offset, window[0] + offset, window[1] + offset)
|
||||
if window is not None else curve.piece_at(x + offset))
|
||||
if piece is not None:
|
||||
color_index = self.panel._result_ids[id(curve)] if self._external_curve is None else 0
|
||||
text = curve.label + '\n' + piece.text(origin + offset, unit)
|
||||
@@ -369,7 +371,7 @@ class PlotProcessingAttachment(QObject):
|
||||
self.dialog.raise_()
|
||||
self.dialog.activateWindow()
|
||||
|
||||
def paint(self, painter, rect, project):
|
||||
def paint(self, painter, rect, project, project_series=None):
|
||||
curves = self.curves
|
||||
if not curves:
|
||||
return
|
||||
@@ -378,7 +380,9 @@ class PlotProcessingAttachment(QObject):
|
||||
for curve_index, curve in enumerate(curves):
|
||||
path = QPainterPath()
|
||||
for index, (x, y) in enumerate(curve.points):
|
||||
point = project(x - (self._external_offset if self._external_curve is not None else 0), y, rect)
|
||||
stamp = x - (self._external_offset if self._external_curve is not None else 0)
|
||||
point = (project_series(curve.request.series, stamp, y, rect) if project_series
|
||||
else project(stamp, y, rect))
|
||||
path.moveTo(point) if index == 0 else path.lineTo(point)
|
||||
color_index = self.panel._result_ids[id(curve)] if self._external_curve is None else 0
|
||||
color = QColor(RESULT_COLORS[color_index % len(RESULT_COLORS)])
|
||||
|
||||
Reference in New Issue
Block a user