33 from python_qt_binding.QtCore
import Slot, Qt, qVersion, qWarning, Signal
34 from python_qt_binding.QtGui
import QColor
35 from python_qt_binding.QtWidgets
import QVBoxLayout, QWidget
37 if qVersion().startswith(
'5.'):
39 from pkg_resources
import parse_version
44 return [int(x)
for x
in re.sub(
r'(\.0+)*$',
'', s).split(
'.')]
47 from pyqtgraph
import __version__
as pyqtgraph_version
53 pyqtgraph_version = pkg_resources.get_distribution(
"pyqtgraph").version
56 raise ImportError(
'A newer PyQtGraph version is required (at least 0.10 for Qt 5)')
58 from pyqtgraph
import PlotWidget, mkPen, mkBrush
64 limits_changed = Signal()
67 super(PyQtGraphDataPlot, self).
__init__(parent)
69 self._plot_widget.getPlotItem().addLegend()
70 self._plot_widget.setBackground((255, 255, 255))
71 self._plot_widget.setXRange(0, 10, padding=0)
75 self._plot_widget.getPlotItem().sigRangeChanged.connect(self.
limits_changed)
80 def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=
False):
81 pen = mkPen(curve_color, width=1)
83 symbolPen = mkPen(QColor(Qt.black))
84 symbolBrush = mkBrush(curve_color)
87 plot = self._plot_widget.plot(name=curve_name, pen=pen, symbol=symbol,
88 symbolPen=symbolPen, symbolBrush=symbolBrush, symbolSize=4)
90 plot = self._plot_widget.plot(name=curve_name, pen=pen)
94 curve_id = str(curve_id)
96 self._plot_widget.removeItem(self.
_curves[curve_id])
102 self._plot_widget.clear()
103 self._plot_widget.getPlotItem().legend.items = []
104 for curve
in self._curves.values():
105 self._plot_widget.addItem(curve)
113 curve = self._curves[curve_id]
114 curve.setData(data_x, data_y)
123 self._plot_widget.setXRange(limits[0], limits[1], padding=0)
126 self._plot_widget.setYRange(limits[0], limits[1], padding=0)
129 x_range, _ = self._plot_widget.viewRange()
133 _, y_range = self._plot_widget.viewRange()
def vline(self, x, color)
def set_values(self, curve_id, data_x, data_y)
def remove_curve(self, curve_id)
def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=False)
def __init__(self, parent=None)
def set_xlim(self, limits)
def set_ylim(self, limits)