QCustomPlot Discussion and Comments

How to display the data in vector normally?Return to overview

Hello, everyone!
below is my code:
---------------------------------------------------------------------
QVector<qreal> x(5), y(5);

x[0] = 20; y[0] = 20;
x[1] = 80; y[1] = 50;
x[2] = 20; y[2] = 50;
x[3] = 80; y[3] = 20;
x[4] = 20; y[4] = 20;

ui.customPlot->graph(0)->setData(x, y, true);
qMessageBox("Pause");

x.append(10); y.append(10);

ui.customPlot->graph(0)->setData(x, y, true);
ui.customPlot->replot();
---------------------------------------------------------------------
before the line: qMessageBox("Pause"), the hope graphic is like this,
--
X
--
but in fact, it is like this,
/|

after the excuting the line : x.append(10); y.append(10);
this graphic is right !

what's the wrong ? Could anyone tell me ? Thank you very much !
my E-mail : kngboy@126.com
Thank you !

the plot doesnt redraw until it gets back to the event loop after calling replot. if you put the replot before the messagebox, it should work.