QCustomPlot Discussion and Comments

Updating text label and position in realtimeReturn to overview

I am creating a text one time.
Now I want to update this text and its position on screen multiple times.
The plot has x axis as date time and y axis as double.

Creating logic

textLabel = new QCPItemText(chartPlot);
    textLabel->setPositionAlignment(Qt::AlignTop|Qt::AlignHCenter);
    textLabel->position->setType(QCPItemPosition::ptPlotCoords);
    textLabel->setPen(QPen(Qt::black));

Updating Logic

textLabel->position->setCoords(*time,*price);
textLabel->setText(QString::number(*price));

When I try to update the program crashes.What I am going wrong?

anyone?

Hellowwwww guys...can anyone help here? Stuck here badly..

The code you've postet looks correct. So your error must be somewhere else. For example, are time and price actually valid pointers at the time the code is called? Is textLabel a valid pointer at the time?