PlotWidget
::PlotWidget(QWidget * parent,
double * _ySession,
QString name,
int rate,
int numVis,
int numSess
) // data stuff....
//canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
canvas()->setLineWidth(1);
canvas()->setMidLineWidth(0);
setCanvasBackground
(QColor(Qt
::white));
enableAxis
(QwtPlot::xBottom,
false);
setMargin(0);
setAxisScale
(QwtPlot::xBottom,
0.0, sizeLoop
);
setAxisScale
(QwtPlot::yLeft,
1500,
3000,
0 );
setAxisMaxMajor
(QwtPlot::yLeft,
8);
setAxisMaxMinor
(QwtPlot::yLeft,
5);
QwtValueList vlist[3];
for(double i=0;i<sizeLoop; i+=((sizeLoop-0)/13*5))
vlist[0] << i;
for(double i=0;i<sizeLoop; i+=((sizeLoop-0)/13))
vlist[1] << i;
for(double i=0;i<sizeLoop; i+=((sizeLoop-0)/13))
vlist[2] << i;
setAxisScaleDiv
(QwtPlot::xBottom, scdiv
);
// for inside margin (I think)
//curve->setRenderHint(QwtPlotItem::RenderAntialiased);
pen->setWidthF(penWidth + penWidthDiff);
curve->setPen(*pen);
curve->attach(this);
curve->setRawData(xLoop, yLoop, sizeLoop);
grid->enableXMin(true);
grid->enableYMin(true);
gridMinPen
= new QPen(QColor(255,
230,
230),
0, Qt
::SolidLine, Qt
::RoundCap, Qt
::RoundJoin);
gridMajPen
= new QPen(QColor(255,
200,
200),
0, Qt
::SolidLine, Qt
::RoundCap, Qt
::RoundJoin);
grid->setMajPen(*gridMajPen);
grid->setMinPen(*gridMinPen);
grid->attach(this);
}
PlotWidget::PlotWidget(QWidget * parent, double * _ySession,
QString name, int rate, int numVis, int numSess)
: QwtPlot(parent) {
// data stuff....
QwtPainter::setDeviceClipping(false);
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, true);
canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, true);
//canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
canvas()->setFrameStyle(QFrame::Box | QFrame::Plain);
canvas()->setLineWidth(1);
canvas()->setMidLineWidth(0);
setCanvasBackground(QColor(Qt::white));
enableAxis(QwtPlot::xBottom, false);
enableAxis(QwtPlot::yLeft, false);
setMargin(0);
setAxisScale(QwtPlot::xBottom,0.0, sizeLoop);
setAxisScale(QwtPlot::yLeft,1500, 3000, 0 );
setAxisMaxMajor(QwtPlot::yLeft, 8);
setAxisMaxMinor(QwtPlot::yLeft, 5);
QwtValueList vlist[3];
for(double i=0;i<sizeLoop; i+=((sizeLoop-0)/13*5))
vlist[0] << i;
for(double i=0;i<sizeLoop; i+=((sizeLoop-0)/13))
vlist[1] << i;
for(double i=0;i<sizeLoop; i+=((sizeLoop-0)/13))
vlist[2] << i;
QwtScaleDiv scdiv(0, sizeLoop, vlist);
setAxisScaleDiv(QwtPlot::xBottom, scdiv);
// for inside margin (I think)
axisScaleEngine(QwtPlot::xBottom)->setAttributes(QwtScaleEngine::Floating);
axisScaleEngine(QwtPlot::xTop)->setAttributes(QwtScaleEngine::Floating);
axisScaleEngine(QwtPlot::yLeft)->setAttributes(QwtScaleEngine::Floating);
axisScaleEngine(QwtPlot::yRight)->setAttributes(QwtScaleEngine::Floating);
curve = new QwtPlotCurve(name);
//curve->setRenderHint(QwtPlotItem::RenderAntialiased);
pen->setWidthF(penWidth + penWidthDiff);
curve->setPen(*pen);
curve->attach(this);
curve->setRawData(xLoop, yLoop, sizeLoop);
grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->enableYMin(true);
gridMinPen = new QPen(QColor(255, 230, 230), 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
gridMajPen = new QPen(QColor(255, 200, 200), 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
grid->setMajPen(*gridMajPen);
grid->setMinPen(*gridMinPen);
grid->attach(this);
}
To copy to clipboard, switch view to plain text mode
Bookmarks