PDA

View Full Version : Tooltip in Qwt



Ankitha Varsha
29th January 2008, 09:50
Hi,

I am plotting graphs using QWT in my application (Qt4).


Qt4 provides QTooltip class for displaying tooltips but I wanted to know whether QWT provides any function or class for displaying tooltips for the points in the graphs?

Pls let me know :)

hamid ghous
2nd December 2009, 04:09
Hi,

Did you find the solution for this. I am trying to implement the same thing. A Tooltip that shows the name of the point. I have values (x,y) in two arrays and labels for these values in a 3rd array. How can I display the label of each point as tooltip.

would appreciate for your help.


cheers,

Ban-chan
2nd December 2009, 17:19
Subclass a qwtplotpicker. Supply it with your data and what you want to display. Enable the tracker. enable mouse tracking on the plot. Attach it to the plot.

the function virtual QwtText trackerText(const QwtDoublePoint & pos) const
will receive points as the cursor moves over them and returns text based on whatever you want it to return.

hamid ghous
5th December 2009, 10:31
Hi Ban-Chan,

Thanks for reply. I was actually looking at Qwtplotpicker class but problem with that was QwtPlotPicker (int xAxis, int yAxis, QwtPlotCanvas * canvas) has xAxis and yAxis as int but my data (xarray and yarray) are in double and secondly how can I pass label array in this constructor.

I would really appreciate your help.

cheers,

Uwe
5th December 2009, 14:09
I was actually looking at Qwtplotpicker class but problem with that was QwtPlotPicker (int xAxis, int yAxis, QwtPlotCanvas * canvas) has xAxis and yAxis as int but my data (xarray and yarray) are in double ...
xAxis/yAxis specifies the axes ( = coordinate system ) of the picker but not the coordinates. Possible values are f.e yLeft/xBottom.

Your answer shows that you completely misunderstood, what a picker is about.

Uwe

hamid ghous
8th December 2009, 13:07
Hi Uwe,

Yeh you are right I didnt understand what's actually Qwtplotpicker class is doing... I through its documentation again and again and now I am trying to implement it. But I am getting an error on my first step.
Here is it..

QwtPlotCanvas qc(myPlot);

int xAxis = myPlot->xBottom;
int yAxis=myPlot->yLeft;

QwtPlotPicker *pk = new (xAxis, yAxis, QwtPicker::PointSelection , QwtPlotPicker::RectRubberBand, QwtPicker::AlwaysOn, qc);


Error is: No matching function for call to QwtPlotPicker::QwtPlotPicker(.....)

I know I am doing some kind of basic mistake but I have gone through some docs but couldnt find it y its giving me this error.

Thanks for you help.

cheers,