I have implemented a Line Graph using QChartView.
In this graph, I have implemented a panning feature. Code for panning is given as follows.
The panning feature is working.void ChartView::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Left:
chart()->scroll(-10, 0);
break;
case Qt::Key_Right:
chart()->scroll(10, 0);
break;
default:
QGraphicsView::keyPressEvent(event);
break;
}
}
However, I want to add limits to panning like 0 ~ 500000. Once the graph axis reaches 500000, panning should stop.
Any suggestions?
Bookmarks