MCPcopy Create free account
hub / github.com/PyQt5/PyQt / update_data

Method update_data

QtChart/CpuLineChart.py:59–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

57 self.m_timer.start(1000)
58
59 def update_data(self):
60 value = cpu_percent()
61 now = QDateTime.currentDateTime()
62 self.m_axisX.setRange(now.addSecs(-self.m_count), now) # 重新调整x轴的时间范围
63 # 获取原来的所有点,去掉第一个并追加新的一个
64 points = self.m_series.pointsVector()
65 points.pop(0)
66 points.append(QPointF(now.toMSecsSinceEpoch(), value))
67 # 替换法速度更快
68 self.m_series.replace(points)
69
70
71if __name__ == '__main__':

Callers

nothing calls this directly

Calls 1

setRangeMethod · 0.45

Tested by

no test coverage detected