QCustomPlot Discussion and Comments

Interact with 2 Points on a GraphReturn to overview

Hey

Thx for your help here, read through some threads already and you are doing a great support job here!

I have a question regarding something that sounds quite usefully but I didnt find an example in the codes I can download here. So, here is the thing:

I draw multiple graphs, say for example two, with qcustomplot. Now I want to select a point on one graph, a second point on the other one and have a line drawn. I would want this line to show the difference between the values:
O
|
|
| 22,5|
|
|
O

Did I describe accuratly what I want :)

This can be realized with two QCPItemTracers, one on each graph. You can synchronize the horizontal position of the tracers by passing the same key (setGraphKey) to them, e.g. in a mouse signal. If you want interpolation (smooth movement of the tracers, not jumping from graph point to point), turn it on via setInterpolating.

The line can be created easily with a QCPItemLine item. Set the parent anchor of its start position to the first tracer and the parent anchor of the line's end position to the second tracer. The line will now automatically place itself connecting the two tracers. A QCPItemText allows displaying text, e.g. the calculated distance.

Of course the whole thing should be put in an own class that manages the tracers and the line, to make it elegantly handleable. There you can also calculate the distance between the two tracers.

is there any example code for QCPitemTracers?
The other problem is the mouse signal. I thought about using this: http://www.qcustomplot.com/index.php/support/forum/183 - but I wonder if there is a built in function for that too? If not, that would be a charm for the next version update.