Tooltip in a point of a graph
Unsolved
General and Desktop
-
Hi, I want to put a toolTip in a point of a graph...I tried:
double x_c = ui->widget->xAxis->coordToPixel(x_widg);
double y_c = ui->widget->yAxis->coordToPixel(y_widg);
QPoint coord;
y_c = coord.y();
x_c= coord.x();QToolTip::showText(coord, line9);
x_widg and y_widg are the coordinates of the point...I tried this way but without solution..
-
@vale88 said in Tooltip in a point of a graph:
QPoint coord;
y_c = coord.y();
x_c= coord.x();These two lines are completely useless because https://doc.qt.io/qt-5/qpoint.html#QPoint, so you set x_c, y_c and coord to 0.
It should actually bedouble x_c = ui->widget->xAxis->coordToPixel(x_widg); double y_c = ui->widget->yAxis->coordToPixel(y_widg); QPoint coord(x_c, y_c); QToolTip::showText(coord, line9);
-
Are you looking for something like this? https://doc.qt.io/qt-5/qtcharts-callout-example.html
-
@vale88 said in Tooltip in a point of a graph:
x_widg,y_widg
what values do they have and how did you get them?