Changeset - 92e73c460a79
[Not reviewed]
barplot
0 2 0
Hasan Yavuz Ă–ZDERYA - 8 years ago 2017-10-03 07:46:53
hy@ozderya.net
update barplot on start
2 files changed with 11 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/barplot.cpp
Show inline comments
 
@@ -16,18 +16,21 @@
 
  You should have received a copy of the GNU General Public License
 
  along with serialplot.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include "barplot.h"
 

	
 
BarPlot::BarPlot(ChannelManager* channelMan, QWidget* parent) :
 
    QwtPlot(parent), barChart(channelMan)
 
{
 
    _channelMan = channelMan;
 
    barChart.attach(this);
 

	
 
    connect(_channelMan, &ChannelManager::dataAdded, [this]()
 
            {
 
                barChart.resample();
 
                replot();
 
            });
 
    connect(_channelMan, &ChannelManager::dataAdded, this, &BarPlot::update);
 
    connect(_channelMan, &ChannelManager::numOfChannelsChanged, this, &BarPlot::update);
 
}
 

	
 
void BarPlot::update()
 
{
 
    barChart.resample();
 
    replot();
 
}
src/barplot.h
Show inline comments
 
@@ -28,15 +28,18 @@
 
class BarPlot : public QwtPlot
 
{
 
    Q_OBJECT
 

	
 
public:
 
    explicit BarPlot(ChannelManager* channelMan, QWidget* parent = 0);
 

	
 
private:
 
    ChannelManager* _channelMan;
 
    BarChart barChart;
 

	
 
    QVector<double> chartData() const;
 

	
 
private slots:
 
    void update();
 
};
 

	
 
#endif // BARPLOT_H
0 comments (0 inline, 0 general)