Changeset - da1c905338e1
[Not reviewed]
barplot
0 3 0
Hasan Yavuz Ă–ZDERYA - 8 years ago 2017-10-25 14:35:25
hy@ozderya.net
set y axis of bar plot
3 files changed with 20 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/barplot.cpp
Show inline comments
 
@@ -37,6 +37,18 @@ void BarPlot::update()
 
{
 
    // Note: -0.99 is used instead of -1 to handle the case of `numOfChannels==1`
 
    setAxisScale(QwtPlot::xBottom, 0, _channelMan->numOfChannels()-0.99, 1);
 
    barChart.resample();
 
    replot();
 
}
 

	
 
void BarPlot::setYAxis(bool autoScaled, double yMin, double yMax)
 
{
 
    if (autoScaled)
 
    {
 
        setAxisAutoScale(QwtPlot::yLeft);
 
    }
 
    else
 
    {
 
        setAxisScale(QwtPlot::yLeft, yMin, yMax);
 
    }
 
}
src/barplot.h
Show inline comments
 
@@ -29,12 +29,16 @@ class BarPlot : public QwtPlot
 
{
 
    Q_OBJECT
 

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

	
 
public slots:
 
    /// Set the Y axis
 
    void setYAxis(bool autoScaled, double yMin = 0, double yMax = 1);
 

	
 
private:
 
    ChannelManager* _channelMan;
 
    BarChart barChart;
 

	
 
    QVector<double> chartData() const;
 

	
src/mainwindow.cpp
Show inline comments
 
@@ -152,12 +152,16 @@ MainWindow::MainWindow(QWidget *parent) 
 
    connect(&plotControlPanel, &PlotControlPanel::xScaleChanged,
 
            plotMan, &PlotManager::setXAxis);
 

	
 
    connect(&plotControlPanel, &PlotControlPanel::plotWidthChanged,
 
            plotMan, &PlotManager::setPlotWidth);
 

	
 
    // secondary (bar) plot signals
 
    connect(&plotControlPanel, &PlotControlPanel::yScaleChanged,
 
            &barPlot, &BarPlot::setYAxis);
 

	
 
    QObject::connect(ui->actionClear, SIGNAL(triggered(bool)),
 
                     this, SLOT(clearPlot()));
 

	
 
    QObject::connect(snapshotMan.takeSnapshotAction(), &QAction::triggered,
 
                     plotMan, &PlotManager::flashSnapshotOverlay);
 

	
0 comments (0 inline, 0 general)