QCustomPlot Discussion and Comments

how to add a text lable to a point plotted by QCustomplot?Return to overview

I have plotted some points in a graph using QCustomPlot, now I want to add text labels to these points seperately, how to do that?
Any help will be appreciated.

you can use this way to do it!

Fristly, you need init.

QCPItemText textLabel;
textLabel = new QCPItemText((ui->plotname);
textLabel->setText("");
textLabel->SetColor(Qt::White);
textLabel->setFont(QFont(font.family(),10));
textLabel->setPen(QPen(Qt::black));


Finally, use this where u take param to plot.

textLabel->position->setCoords(y, getValuetoPlot);
textLabel->setText("Value: " + QString::number(getValuetoPlot));


hope this useful for u

thanks a lot, I know how to do it https://www.qcustomplot.com/index.php/support/forum/2165#