diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -134,6 +134,7 @@ add_executable(${PROGRAM_NAME} WIN32
src/framedreader.cpp
src/framedreadersettings.cpp
src/plotmanager.cpp
+ src/barplot.cpp
src/numberformat.cpp
src/updatechecker.cpp
src/versionnumber.cpp
diff --git a/src/barplot.cpp b/src/barplot.cpp
new file mode 100644
--- /dev/null
+++ b/src/barplot.cpp
@@ -0,0 +1,45 @@
+/*
+ Copyright © 2017 Hasan Yavuz Özderya
+
+ This file is part of serialplot.
+
+ serialplot 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.
+
+ serialplot 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 serialplot. If not, see .
+*/
+
+#include "barplot.h"
+
+BarPlot::BarPlot(ChannelManager* channelMan, QWidget* parent) :
+ QwtPlot(parent)
+{
+ _channelMan = channelMan;
+ barChart.attach(this);
+
+ connect(_channelMan, &ChannelManager::dataAdded, [this]()
+ {
+ barChart.setSamples(chartData());
+ replot();
+ });
+}
+
+QVector BarPlot::chartData() const
+{
+ unsigned numChannels = _channelMan->numOfChannels();
+ unsigned numOfSamples = _channelMan->numOfSamples();
+ QVector data(numChannels);
+ for (int i = 0; i < numChannels; i++)
+ {
+ data[i] = _channelMan->channelBuffer(i)->sample(numOfSamples-1);
+ }
+ return data;
+}
diff --git a/src/barplot.h b/src/barplot.h
new file mode 100644
--- /dev/null
+++ b/src/barplot.h
@@ -0,0 +1,42 @@
+/*
+ Copyright © 2017 Hasan Yavuz Özderya
+
+ This file is part of serialplot.
+
+ serialplot 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.
+
+ serialplot 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 serialplot. If not, see .
+*/
+
+#ifndef BARPLOT_H
+#define BARPLOT_H
+
+#include
+#include
+
+#include "channelmanager.h"
+
+class BarPlot : public QwtPlot
+{
+ Q_OBJECT
+
+public:
+ explicit BarPlot(ChannelManager* channelMan, QWidget* parent = 0);
+
+private:
+ QwtPlotBarChart barChart;
+ ChannelManager* _channelMan;
+
+ QVector chartData() const;
+};
+
+#endif // BARPLOT_H
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -63,6 +63,7 @@ MainWindow::MainWindow(QWidget *parent)
snapshotMan(this, &channelMan),
commandPanel(&serialPort),
dataFormatPanel(&serialPort, &channelMan, &recorder),
+ barPlot(&channelMan),
recordPanel(&recorder, &channelMan),
updateCheckDialog(this)
{
@@ -264,6 +265,8 @@ MainWindow::MainWindow(QWidget *parent)
this->ui->tabWidget->setCurrentWidget(&commandPanel);
this->ui->tabWidget->showTabs();
});
+
+ barPlot.show();
}
MainWindow::~MainWindow()
diff --git a/src/mainwindow.h b/src/mainwindow.h
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -44,6 +44,7 @@
#include "channelmanager.h"
#include "snapshotmanager.h"
#include "plotmanager.h"
+#include "barplot.h"
#include "datarecorder.h"
#include "updatecheckdialog.h"
@@ -78,6 +79,7 @@ private:
QList curves;
ChannelManager channelMan;
PlotManager* plotMan;
+ BarPlot barPlot;
SnapshotManager snapshotMan;
DataRecorder recorder; // operated by `recordPanel`