Commit 6785ac5f authored by Alisson Claudino's avatar Alisson Claudino

Bug na mudança de escala

parent 74d75898
......@@ -5,7 +5,7 @@ class Graph(pyqtgraph.GraphicsLayout):
index=1
def __init__(self,x_range,y_range,x_size,y_size,color1,color2):
def __init__(self,x_range,y_range,x_size,y_size,color1,color2,name1,name2):
super(Graph,self).__init__()
self.x_range = x_range
self.y_range = y_range
......@@ -13,10 +13,14 @@ class Graph(pyqtgraph.GraphicsLayout):
self.y_size = y_size
self.color1 = color1
self.color2 = color2
self.name1=name1
self.name2=name2
self.p1 = self.addPlot()
self.curve1 = self.p1.plot(pen=color1)
self.curve2 = self.p1.plot(pen=color2)
self.p1.addLegend()
self.curve1 = self.p1.plot(pen=color1,name=self.name1)
self.curve2 = self.p1.plot(pen=color2,name=self.name2)
self.p1.showGrid(True, True)
self.setPreferredSize(self.x_size,self.y_size)
self.p1.setXRange(0,self.x_range,padding=0)
self.p1.setYRange(0, self.y_range, padding=0)
......@@ -57,9 +61,11 @@ class Graph(pyqtgraph.GraphicsLayout):
self.y1=[]
self.y2=[]
self.index=0
self.clear()
self.removeItem(self.p1)
self.p1=self.addPlot()
self.p1.setXRange(0, self.x_range, padding=0)
self.p1.setYRange(0, self.y_range, padding=0)
self.curve1=self.p1.plot(pen=self.color1)
self.curve2 = self.p1.plot(pen=self.color2)
\ No newline at end of file
self.p1.addLegend()
self.curve1=self.p1.plot(pen=self.color1,name=self.name1)
self.curve2 = self.p1.plot(pen=self.color2,name=self.name2)
self.p1.showGrid(True,True)
\ No newline at end of file
......@@ -18,7 +18,7 @@ class SystemEngine(object):
self.uiCalibra1 = Ui_MainWindow()
self.uiCalibra1.setupUi(self.dialog)
self.uiCalibra1.serialListPanel(self.ser1.portList)
self.layout = Graph(100, 37500, 900, 600, 'r','g')
self.layout = Graph(100, 30000, 900, 500, 'r','g',"Força","Tensão no Calibrante")
self.scene = QtGui.QGraphicsScene()
self.scene.addItem(self.layout)
self.uiCalibra1.sceneSelector(self.scene)
......@@ -34,17 +34,14 @@ class SystemEngine(object):
readData = self.ser1.read() # Lê o dado da serial
readData = readData.decode('utf8')
dado = readData.split(' ', 3)
print(dado)
try:
self.x_scale=int(self.uiCalibra1.t_max.text())
except ValueError:
self.x_scale=100
if(self.x_scale != self.prev_x_scale):
try:
self.layout.setGraphScale(int(self.x_scale),32700)
except:
print("Err0r")
self.layout.setGraphScale(int(self.x_scale),32700)
self.prev_x_scale = self.x_scale
self.uiCalibra1.forcaLabel.setText(str(dado[0])+" Tonf")
self.uiCalibra1.calibranteLabel.setText(str(dado[1].split()[0])+" mV")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment