May 2019
Intermediate to advanced
542 pages
13h 37m
English
With our refresh method being called five times a second, the data in this series is pretty detailed for such a small chart. A dense chart such as this one is something a user might like to explore in more detail. To implement this capability, we can take advantage of the QChart object's methods for panning and zooming around the chart image, and allow the user to get a better view of the data.
To configure interactive controls for the CPUUsageView class, we can override the keyPressEvent() method, just as we did in our game in Chapter 12, Creating 2D Graphics with QPainter:
def keyPressEvent(self, event): keymap = { qtc.Qt.Key_Up: lambda: self.chart().scroll(0, -10), qtc.Qt.Key_Down: lambda: self.chart().scroll(0, ...Read now
Unlock full access