Hi friends i am trying to print the system time as the Bottom X Axis of a QwtPlot Widget. But i am having problem doing it i get so many errors when i compile is there any easier way to do it.I tried the DataPlot example in this program but i have so many errors. Here is the code

Qt Code:
  1. #include "qwt_plot.h"
  2. #include "qwt_scale_widget.h"
  3. #include <QTimer>
  4. #include <stdlib.h>
  5. #include <qwt_plot_curve.h>
  6. #include <qwt_plot_grid.h>
  7. #include <QTime>
  8.  
  9. PlottingGraph::PlottingGraph(QWidget *parent)
  10. : QDialog(parent)
  11. , m_curve(0)
  12. , m_time(0)
  13.  
  14. {
  15. setupUi(this);
  16. connect(drawButton, SIGNAL(clicked()), this, SLOT(draw()));
  17.  
  18. QTimer *timer = new QTimer(this);
  19. connect(timer, SIGNAL(timeout()), this, SLOT(draw()));
  20. timer->start(300);
  21.  
  22. for (int i = 0; i < 100; i++)
  23. {
  24. m_x[i] = i;
  25. m_y[i] = 0.0;
  26. }
  27.  
  28. myPlot->setTitle("Temperature Channel");
  29. myPlot->setAxisTitle(QwtPlot::xBottom, "System Uptime [h:m:s]");
  30. myPlot->setAxisScaleDraw(QwtPlot::xBottom,
  31. new TimeScaleDraw(cpuStat.upTime()));
  32. myPlot->setAxisScale(QwtPlot::xBottom, 0, HISTORY);
  33. myPlot->setAxisTitle(QwtPlot::yLeft, "Values");
  34. myPlot->setAxisScale(QwtPlot::yLeft, -10000, 10000);
  35. myPlot->setAutoReplot(true);
  36. }
  37. void PlottingGraph::on_drawButton_clicked()
  38. {
  39. }
  40. void PlottingGraph::draw()
  41. {
  42. m_time++;
  43. memmove(m_y, &m_y[1], 99 * sizeof(double));
  44. m_y[99] = 1000 * sin((double)m_time / 360 * 3.1415 * 100) + rand() % 4000 - 2000;
  45. for (int i = 0; i < 100; i++)
  46.  
  47. m_x[i]++;
  48.  
  49. if (!m_curve)
  50. {
  51. m_curve = new QwtPlotCurve();
  52. m_curve->setPen(QPen(Qt::red));
  53. m_curve->setData(m_x, m_y, 100);
  54. QwtPlotGrid *gridy = new QwtPlotGrid();
  55. gridy->attach(myPlot);
  56. m_curve->attach(myPlot);
  57. }
  58. m_curve->setData(m_x, m_y, 100);
  59. myPlot->setAxisScale(QwtPlot::xBottom, timeData[HISTORY - 1], timeData[0]); //m_time, m_time + 100); // auto replots
  60. QTime time = QTime::currentTime();
  61. myPlot->setAxisScale(QwtPlot::xBottom, time.("h:m:s"));
  62. }
  63.  
  64.  
  65. void PlottingGraph::timerEvent(QTimerEvent *)
  66. {
  67. for ( int i = dataCount; i > 0; i-- )
  68. {
  69. for ( int c = 0; c < NCpuData; c++ )
  70. {
  71. if ( i < HISTORY )
  72. data[c].data[i] = data[c].data[i-1];
  73. }
  74. }
  75.  
  76. cpuStat.statistic(data[User].data[0], data[System].data[0]);
  77.  
  78. data[Total].data[0] = data[User].data[0] +
  79. data[System].data[0];
  80. data[Idle].data[0] = 100.0 - data[Total].data[0];
  81.  
  82. if ( dataCount < HISTORY )
  83. dataCount++;
  84.  
  85. for ( int j = 0; j < HISTORY; j++ )
  86. timeData[j]++;
  87.  
  88. setAxisScale(QwtPlot::xBottom,
  89. timeData[HISTORY - 1], timeData[0]);
  90.  
  91. for ( int c = 0; c < NCpuData; c++ )
  92. {
  93. data[c].curve->setRawData(
  94. timeData, data[c].data, dataCount);
  95. }
  96.  
  97. replot();
  98. }
To copy to clipboard, switch view to plain text mode 

Thank You