maveric

15th May 2008, 13:44

hi all,

i am a newbie to this world of QT, and sq lite. I managed to do every thing correctly & tried with some examples also... but got stuck with this problem....

firstly i connected my form with my database ie. sqlite ...i am able to get data and view it in my required format... but now instead of representing data in reports or in some other format i need to plot data in the forms of graphs just like in the qwt example cpuplot.pro.

m_time++;

memmove(m_y, &m_y[1], 99 * sizeof(double));

m_y[99] = 10 * sin((double)m_time / 360 * 3.1415 * 10) + rand() % 80 - 50;

for (int i = 0; i < 100; i++)

m_x[i]++;

if (!m_curve)

{

m_curve = new QwtPlotCurve();

m_curve->setPen(QPen(Qt::red));

m_curve->setData(m_x, m_y, 100);

m_curve->attach(myPlot);

}

m_curve->setData(m_x, m_y,100);

myPlot->setAxisScale(QwtPlot::xBottom, m_time, m_time +100); // auto replots

from the above code i am getting a perfect graph plot by generating random values in the form of a sine wave...

insted of using this formula

10 * sin((double)m_time / 360 * 3.1415 * 10) + rand() % 80 - 50;

i need to get data from database and plot it...

so can any one help me out..

Please view the image attached below to get a clear picture...

thnx in advance.....

c ya...

i am a newbie to this world of QT, and sq lite. I managed to do every thing correctly & tried with some examples also... but got stuck with this problem....

firstly i connected my form with my database ie. sqlite ...i am able to get data and view it in my required format... but now instead of representing data in reports or in some other format i need to plot data in the forms of graphs just like in the qwt example cpuplot.pro.

m_time++;

memmove(m_y, &m_y[1], 99 * sizeof(double));

m_y[99] = 10 * sin((double)m_time / 360 * 3.1415 * 10) + rand() % 80 - 50;

for (int i = 0; i < 100; i++)

m_x[i]++;

if (!m_curve)

{

m_curve = new QwtPlotCurve();

m_curve->setPen(QPen(Qt::red));

m_curve->setData(m_x, m_y, 100);

m_curve->attach(myPlot);

}

m_curve->setData(m_x, m_y,100);

myPlot->setAxisScale(QwtPlot::xBottom, m_time, m_time +100); // auto replots

from the above code i am getting a perfect graph plot by generating random values in the form of a sine wave...

insted of using this formula

10 * sin((double)m_time / 360 * 3.1415 * 10) + rand() % 80 - 50;

i need to get data from database and plot it...

so can any one help me out..

Please view the image attached below to get a clear picture...

thnx in advance.....

c ya...