diff --git a/src/data_plot.cpp b/src/data_plot.cpp
new file mode 100644
--- /dev/null
+++ b/src/data_plot.cpp
@@ -0,0 +1,225 @@
+/*
+ *
+ * This file is part of the Virtual Leaf.
+ *
+ * The Virtual Leaf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Virtual Leaf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with the Virtual Leaf. If not, see .
+ *
+ * Copyright 2010 Roeland Merks.
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "data_plot.h"
+
+static const std::string _module_id("$Id$");
+
+//
+// Initialize main window
+//
+DataPlot::DataPlot(QWidget *parent, const QString title, const QStringList curvenames ):
+ QwtPlot(parent),
+ d_interval(0),
+ d_timerId(-1)
+{
+
+ // Number of curves is number of names given
+ ncurves = curvenames.size();
+
+ // allocate data and curves
+ d_t = new double[PLOT_SIZE];
+ d_x = new double *[ncurves];
+ d_x[0] = new double[ncurves*PLOT_SIZE];
+ for (int i=1;isetPaintAttribute(QwtPlotCanvas::PaintCached, false);
+ //canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
+
+ alignScales();
+
+ // Initialize data
+
+
+ for (int i = 0; i< PLOT_SIZE; i++) {
+ d_t[i] = 0.; // time axis
+ }
+
+ for (int i=0;iopen(QIODevice::WriteOnly | QIODevice::Text))
+ return;
+
+ datstream.setDevice(datfile);
+ */
+
+}
+
+DataPlot::~DataPlot(void) {
+ delete[] d_t ;
+ delete[] d_x[0];
+ delete[] d_x;
+ delete[] curves;
+}
+//
+// Set a plain canvas frame and align the scales to it
+//
+void DataPlot::alignScales()
+{
+ // The code below shows how to align the scales to
+ // the canvas frame, but is also a good example demonstrating
+ // why the spreaded API needs polishing.
+
+ canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
+ canvas()->setLineWidth(1);
+
+ for ( int i = 0; i < QwtPlot::axisCnt; i++ )
+ {
+ QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
+ if ( scaleWidget )
+ scaleWidget->setMargin(0);
+
+ QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i);
+ if ( scaleDraw )
+ scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
+ }
+}
+
+/* void DataPlot::setTimerInterval(double ms)
+{
+ d_interval = qRound(ms);
+
+ if ( d_timerId >= 0 )
+ {
+ killTimer(d_timerId);
+ d_timerId = -1;
+ }
+ if (d_interval >= 0 )
+ d_timerId = startTimer(d_interval);
+}
+*/
+
+// Generate new values
+void DataPlot::AddValue(double t,double *x)
+{
+
+ // std::cerr << "AddValue receives: " << t << ", " << y << ", " << z << std::endl;
+
+ // Plot slowly fills up, then shifts to the left
+ if ( data_pos >= PLOT_SIZE ) {
+
+ for ( int j = 0; j < PLOT_SIZE - 1; j++ )
+ d_t[j] = d_t[j+1];
+
+ for ( int i=0;iresize(400,300);
+
+ show();
+
+}
+
+PlotDialog::~PlotDialog(void) {
+
+ delete plot;
+}
+