QCustomPlot Discussion and Comments

Spectrogram using QCPColorMapReturn to overview

Hello,

I am trying to plot a spectrogram in real-time using QCPColorMap. However, it is much more tricky than the real-time demo using QCustomPlot since QCPColorMap doesn't have the addData() function and shifting the x axis is also much more difficult.
I'm trying to approach this problem that way that first I read one period of spectrogram, then I visualise it in the for loop, then I store the period in a buffer and then when I get the second period of samples I am putting it in a for loop together with the previous period from the buffer etc...But with no success so far.

Is there any easier way to plot spectrogram in real time using QCustomPlot?

Thank you for your answer.

I have make this using ultrasound data and itworks fine. I use a thread to aquire my data and replot all spectrogram every 10 ms.

I can send you my code because it's confidential. but I can help you

@franc Thank you, I could use any help right now and I would appreciate very much

class Mission : public QWidget
{
    Q_OBJECT

public:
    explicit Mission(QWidget *parent = 0);
    ~Mission();


public slots:
    void run();
    void plop();


signals:
    void newAvance(double);
    void newDataBscan();

private:
    Ui::Mission *ui;
    ...
    QFutureWatcher<void> watcher;
};

le .cpp

void Mission::run()
{
    if(running)
        return;

    qDebug () <<"RUN";

    raz();
    watcher.setFuture(QtConcurrent::run(this,&Mission::plop));
}

Le thread

void Mission::plop()
while(1){
                        for(int j=UNUSED_DATA_HEADER ; j<scale-2; j++){

                            if(Buffer[i+j] > 255)
                                colorBscan->data()->setCell(lineBscan, j, 0);
                            else
                                colorBscan->data()->setCell(lineBscan, j, Buffer[i+j]);
                        }
                    }
                }
            }                                                //Ne pas oublier le i++ a la fin

            /*if(sizeFIFO/481 > TMP){
            emit valueChangeFIFO(sizeFIFO/481); // this will connect with GUI caller and look *
             TMP = sizeFIFO/481;
            }*/
        }
        emit newData();
    }
}

Main GUI "caller "

connect(this,                  SIGNAL(newData()),    this, SLOT(updateDelay()));

void Mission::updateDelay()
{
    if(!timerUpdateImage->isActive())
        timerUpdateImage->start();
}


if your timerUpdateImage is not active you can launch the refresh
by changing data into.
The timerupdateimage has 10ms interval an the function updatedelay will block all signals newData for 10ms.

https://github.com/Christoph-Lauer/Sonogram

Hi,
do you have a good solution to the problem mentioned above. flowing colorMap plots...
regards