void BrainPlot::timeStep(std::vector<float> data) { /*Curves*/ for(int c = 0; c < nChannels; c++) appendPoint(QPointF(sample%plotLength, data[c]), c); /*Sweep line*/ CurveData *sweep = static_cast<CurveData *>( d_sweep->data() ); sweep->replace(0, QPointF((sample)%plotLength, plotLength)); sweep->replace(1, QPointF((sample)%plotLength, 2*nChannels*minusExpectedAmplitude)); setClipRegion(d_sweep, QPointF(0,0)); d_directPainter->drawSeries( d_sweep, 0, 1); /*Time step*/ sample++; /*Refreshes plot*/ replot(); }
void BrainPlot::appendPoint( QPointF point, int Channel ) { /*Adds new point - with proper index and offset - to the data series*/ CurveData *data = static_cast<CurveData *>( d_curves[Channel]->data() ); point.setY(minusExpectedAmplitude*(2*Channel+1)+point.y()); data->replace(sample%plotLength, point); setClipRegion(d_curves[Channel], point); d_directPainter->drawSeries( d_curves[Channel], data->size() - 1, data->size() - 1 ); }