|
|
#include "wfplot.h"
|
|
|
#include <QFontInfo>
|
|
|
#include <wfdisplay_params.h>
|
|
|
|
|
|
WFPlot::WFPlot(QWidget *parent, unsigned int xmax, unsigned int ymax) :
|
|
|
QWidget(parent)
|
|
|
{
|
|
|
// Create Fonts
|
|
|
QFont font;
|
|
|
font = QFont(this->fontInfo().family(), FONT_SIZE_WAVEFORM_TITLE, QFont::Light);
|
|
|
customPlot = new LppMonPlot();
|
|
|
mainLayout = new QVBoxLayout();
|
|
|
|
|
|
customPlot->setXaxisRange(0, xmax);
|
|
|
customPlot->setYaxisRange(-ymax, ymax);
|
|
|
//customPlot->setTitleFont(font);
|
|
|
|
|
|
customPlot->addGraph();
|
|
|
|
|
|
mainLayout->addWidget(customPlot);
|
|
|
|
|
|
this->setLayout(mainLayout);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WFPlot::displayOnPlot(short *data, unsigned int size)
|
|
|
{
|
|
|
QList<QVariant> qListX;
|
|
|
QList<QVariant> qListY;
|
|
|
qListX.clear();
|
|
|
qListY.clear();
|
|
|
|
|
|
for (unsigned int i=0; i<size; ++i)
|
|
|
{
|
|
|
qListX.append(i);
|
|
|
qListY.append( (double) data[i] );
|
|
|
}
|
|
|
|
|
|
customPlot->setGraphData(0, qListX, qListY);
|
|
|
//customPlot->rescaleAxis();
|
|
|
}
|
|
|
|
|
|
void WFPlot::displayOnPlotFloat(float *data, unsigned int size)
|
|
|
{
|
|
|
QList<QVariant> qListX;
|
|
|
QList<QVariant> qListY;
|
|
|
qListX.clear();
|
|
|
qListY.clear();
|
|
|
|
|
|
for (unsigned int i=0; i<size; ++i)
|
|
|
{
|
|
|
qListX.append(i);
|
|
|
qListY.append( (double) data[i] );
|
|
|
}
|
|
|
|
|
|
customPlot->setGraphData(0, qListX, qListY);
|
|
|
//customPlot->rescaleAxis();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|