Hi
I am trying to set the graph so that when users zoom in or drag the graph they will never see the negative x-axis. Here is my connect statement:
connect(ui->graph_1, SIGNAL(beforeReplot()),this,SLOT(PlotRangeChanged()));
And here is the custom slot:
void myapp::PlotRangeChanged() { if(ui->graph_1->xAxis->range().lower <= 0) { ui->graph_1->xAxis->setRangeLower(0); } if(ui->graph_1->xAxis->range().upper <= 1) { ui->graph_1->xAxis->setRangeUpper(1); } }
My problem is, it works in some ways but not all. I mean, if I drag the graph to the right(toward to positive infinite) slowly, the x-axis will not show the negative value. However, when I drag it in a fast way or holding the left button pressed and keep dragging I will still see the negative part. Once I press the mouse again the checking works again. Any idea about how to avoid "over dragging"?
(Sorry for bad description)