PDA

View Full Version : qwtplot curvetracking for 2 graphs



rafae12
28th May 2015, 13:27
I have copied the code from curvetracker.
the code i use draws a vertical line and a tooltip gets displayed with current value at that point where the mouse is moved.

I have 2 qwtplots that are aligned vertically the have the same axis length.

I would like it that when i hover on any of the graphs. a vertical line will be drawn for both graphs at the same index and show the current value.

how can i do this?

Thanks

Uwe
28th May 2015, 14:07
You need to have 2 trackers and to write some code to synchronize both. I have written such a thing several times, but unfortunately don't have some code snippets left on my disk.

Uwe

rafae12
28th May 2015, 15:01
i have created two trackers. i created a test slot in my mainwindow and i see the position changing

void MainWindow::updatetracker(QPoint pos)
{
qDebug() << "x position" << pos.x() << " y position" << pos.y();
}

which SLOT do i connect the moved SIGNAL to.

QObject::connect(tracker1,SIGNAL(moved(QPoint)), ??? , ??? );
QObject::connect(tracker2,SIGNAL(moved(QPoint)), ??? , ??? );

rafae12
3rd June 2015, 08:33
i could not get it to work with 2 trackers.
i just connected to a slot that draws and clears an overlay on the 2nd chart when i move the mouse on the first chart and vice versa.

HappyCoder
24th July 2015, 08:07
You need to have 2 trackers and to write some code to synchronize both.
Uwe

Hello Uwe,

i have two trackers ( trackerA and trackerB), i have no idea how to synchronize both.
Can you give some hints to "some code", not only for me, also for other that are interessted here.

I tried:

1)
trackerA singal activated(bool on )


if(on)
trackerB->setTrackerMode( QwtPlotPicker::AlwaysOn );
else
trackerB->setTrackerMode( QwtPlotPicker::ActiveOnly );


But that doesn't work

Thank you
Stefan