Beispiel #1
0
EcgCh::EcgCh(QWidget *parent) :
    QwtPlot(parent)
{
     setMinimumHeight(10);
     setMinimumWidth(10);
     QwtPlotGrid *grid = new QwtPlotGrid;
     grid->enableXMin(true);
     grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
     grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
     grid->attach(this);
     setAxisTitle(QwtPlot::xBottom, "Czas [hh:mm:ss.ms]");
     setAxisTitle(QwtPlot::yLeft, "Amplituda [mV]");
//     picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, canvas());
//     picker->setStateMachine(new QwtPickerDragPointMachine());
//     picker->setRubberBandPen(QColor(Qt::green));
//     picker->setRubberBand(QwtPicker::CrossRubberBand);
//     picker->setTrackerPen(QColor(Qt::white));
     curve = new QwtPlotCurve("signal");
     curve->setYAxis(QwtPlot::yLeft);
     curve->attach(this);
     peaksCurve = new QwtPlotCurve("signal");
     peaksCurve->setYAxis(QwtPlot::yLeft);
     peaksCurve->setStyle(QwtPlotCurve::CurveStyle::Dots);
     peaksCurve->setPen(QPen(Qt::red, 5));
     peaksCurve->attach(this);
     samples = new QVector<QPointF>;
     data = new QwtPointSeriesData;
     peaksSamples = new QVector<QPointF>;
     peaksData = new QwtPointSeriesData;
     replot();
}
Beispiel #2
0
void Plot::timerEvent( QTimerEvent * )
{
    circular_buffer.pop_back();
    double data = sensor_callback();
    circular_buffer.push_front(data);
    d_curve->setSamples(x_sample, circular_buffer);
    replot();
    /*
    switch( d_settings.updateType )
    {
        case Settings::RepaintCanvas:
        {
            // the axes in this example doesn't change. So all we need to do
            // is to repaint the canvas.

            canvas()->replot();
            break;
        }
        default:
        {
            replot();
        }
    }
    */
}
void SagittalZMPPlot::push(SensorValues sensors, bool left) {
   if (left)
      for (int i = PLOT_SIZE-1; i > 0; --i)
         data[i] = data[i-1];
   else
      for (int i = 0; i < PLOT_SIZE - 1; ++i)
         data[i] = data[i+1];
   float total_weight = (sensors.sensors[Sensors::LFoot_FSR_FrontLeft]
                       + sensors.sensors[Sensors::LFoot_FSR_FrontRight]
                       + sensors.sensors[Sensors::LFoot_FSR_RearLeft]
                       + sensors.sensors[Sensors::LFoot_FSR_RearRight]
                       + sensors.sensors[Sensors::RFoot_FSR_FrontLeft]
                       + sensors.sensors[Sensors::RFoot_FSR_FrontRight]
                       + sensors.sensors[Sensors::RFoot_FSR_RearLeft]
                       + sensors.sensors[Sensors::RFoot_FSR_RearRight]);
   if (total_weight != 0)
      data[left ? 0 : PLOT_SIZE - 1] = 
         (50.0f*sensors.sensors[Sensors::LFoot_FSR_FrontLeft]
        + 50.0f*sensors.sensors[Sensors::LFoot_FSR_FrontRight]
        - 50.0f*sensors.sensors[Sensors::LFoot_FSR_RearLeft]
        - 50.0f*sensors.sensors[Sensors::LFoot_FSR_RearRight]
        + 50.0f*sensors.sensors[Sensors::RFoot_FSR_FrontLeft]
        + 50.0f*sensors.sensors[Sensors::RFoot_FSR_FrontRight]
        - 50.0f*sensors.sensors[Sensors::RFoot_FSR_RearLeft]
        - 50.0f*sensors.sensors[Sensors::RFoot_FSR_RearRight]) / total_weight;
   else
      data[left ? 0 : PLOT_SIZE - 1] = 0.0f;
   replot();
}
void OdomPlot::push(Odometry vision, Odometry motion, Odometry combined, bool left) {
   if (left)
      for (int i = PLOT_SIZE-1; i > 0; --i){
         motionData[i] = motionData[i-1];
         visionData[i] = visionData[i-1];
         combinedData[i] = combinedData[i-1];
      }
   else
      for (int i = 0; i < PLOT_SIZE - 1; ++i){
         motionData[i] = motionData[i+1];
         visionData[i] = visionData[i+1];
         combinedData[i] = combinedData[i+1];
      }
   motionData[left ? 0 : PLOT_SIZE - 1] = RAD2DEG(motion.turn);
   visionData[left ? 0 : PLOT_SIZE - 1] = RAD2DEG(vision.turn);
   combinedData[left ? 0 : PLOT_SIZE - 1] = RAD2DEG(combined.turn);

   //std::cout << RAD2DEG(motion.turn) << "\t" << RAD2DEG(vision.turn) << "\t" << RAD2DEG(combined.turn) << "\n";

   for(int i=0; i< (PLOT_SIZE-2); ++i){
      motionDiff[i] = motionData[i+1] - motionData[i];
      visionDiff[i] = visionData[i+1] - visionData[i];
      combinedDiff[i] = combinedData[i+1] - combinedData[i];
   }

   replot();
}
void FsrPlot::push(SensorValues sensors, bool left) {
   if (left)
      for (int i = PLOT_SIZE-1; i > 0; --i) {
         data_l[i] = data_l[i-1];
         data_r[i] = data_r[i-1];
         data_t[i] = data_t[i-1];
         data_r2[i] = data_r2[i-1];
      }
   else
      for (int i = 0; i < PLOT_SIZE - 1; ++i) {
         data_l[i] = data_l[i+1];
         data_r[i] = data_r[i+1];
         data_t[i] = data_t[i+1];
         data_r2[i] = data_r2[i+1];
      }
   data_l[left ? 0 : PLOT_SIZE - 1] =
         RAD2DEG(sensors.sensors[Sensors::InertialSensor_AngleX]);
//      sensors.sensors[Sensors::LFoot_FSR_FrontLeft] +
//      sensors.sensors[Sensors::LFoot_FSR_FrontRight] +
//      sensors.sensors[Sensors::LFoot_FSR_RearLeft] +
//      sensors.sensors[Sensors::LFoot_FSR_RearRight];
//   data_r[left ? 0 : PLOT_SIZE - 1] =
//         RAD2DEG(sensors.sensors[Sensors::LFoot_FSR_CenterOfPressure_X]);
//         RAD2DEG(sensors.sensors[Sensors::InertialSensor_GyrY]);
//      sensors.sensors[Sensors::RFoot_FSR_FrontLeft] +
//      sensors.sensors[Sensors::RFoot_FSR_FrontRight] +
//      sensors.sensors[Sensors::RFoot_FSR_RearLeft] +
//      sensors.sensors[Sensors::RFoot_FSR_RearRight];
//   data_t[left ? 0 : PLOT_SIZE - 1] = 0;
//      data_l[left ? 0 : PLOT_SIZE - 1] + data_r[left ? 0 : PLOT_SIZE - 1];
//   data_r2[left ? 0 : PLOT_SIZE - 1] =
//         RAD2DEG(sensors.sensors[Sensors::InertialSensor_AccY]) * 100.0;
         //         RAD2DEG(sensors.sensors[Sensors::LFoot_FSR_CenterOfPressure_Y]);
   replot();
}
Beispiel #6
0
void Plot::applySettings( const Settings &settings )
{
    applyAxisSettings( QwtAxis::yLeft, settings );
    applyAxisSettings( QwtAxis::yRight, settings );

    replot();
}
void LinesVisualisation::performStepComputation()
{

    // do not perform painting if not visible
    if(!isVisible())
        return;

    clearGraphs();
    QVector<double> x, y;

    // Paint the best
    for (int i = 0; i < swarm()->size(); i++) {
        const Particle *particle = (*swarm())[i];
        x.clear();
        y.clear();
        y = particle->position;
        for (int j = 0; j < swarm()->dimension(); j++) {
            x.append(j + 1);
        }
        addGraph();
        graph(i)->setData(x, y);
        graph(i)->setPen(VisualisationHelper::rainbowCoding(i, swarm()->size()));
    }
    xAxis->setRange(0, swarm()->dimension());
    if (swarm()->dimension() < 20)
    {
        xAxis->setAutoTickStep(false);
        xAxis->setTickStep(1);
    }
    rescaleAxes(true);
    setInteraction(QCP::iRangeDrag, true);
    setInteraction(QCP::iRangeZoom, true);
    replot();
}
void SweepInspector::loadSweep(int index) {
  //load in new sweep values from data
  if (data == NULL) return;
  if ( (index < 0)  || (index >= data->getNumSweeps())) return;

  //remove old data and get new
  if (d_curve) d_curve->attach(NULL);
  detachItems();
  fsweep sweep = data->getSweep(index);

  d_curve = new QwtPlotCurve( data->timestampFromIndex(index) ); //Qwt will delete() this when its done with it
  d_curve->setRenderHint( QwtPlotItem::RenderAntialiased );
  d_curve->setStyle( QwtPlotCurve::Lines );
  d_curve->setPen( QColor( Qt::yellow ), 2, Qt::SolidLine );
  d_curve->setSamples( sweep );
  d_curve->attach(this);

  QwtInterval frange = data->limits(FREQ);
  //setAxisScale(QwtPlot::xBottom, frange.minValue(), frange.maxValue(), (frange.maxValue() - frange.minValue())/ 5.0);
  //setAxisScale(QwtPlot::yLeft, -135, 20, 10.0);
  setTitle( QString("RF Sweep @ %1").arg(data->timestampFromIndex(index)) );
  //set maximum zoom out
  zoomer->setZoomBase(QRectF(QPointF(frange.minValue(), 40), QPointF(frange.maxValue(), -135)));
  zoomer->zoomBase();

  //find max, min, and average values and drop it on plot as well
  double max = sweep.first().y(), min = sweep.first().y(), avg=0;
  for(int i=0; i < sweep.size(); i++) {
    max = std::max(max, sweep.at(i).y());
    min = std::min(min, sweep.at(i).y());
    avg += sweep.at(i).y();
  } avg /= sweep.size();

  //add markers onto the plot
  QwtPlotMarker *one = new QwtPlotMarker(), *two = new QwtPlotMarker();
  one->attach(this); one->setAxes(QwtPlot::xTop, QwtPlot::yRight);
  two->attach(this); two->setAxes(QwtPlot::xTop, QwtPlot::yRight);

  QwtText tone = QwtText(QString("Max: %1 dBm\nMin: %2 dBm\nAvg: %3 dBm").arg(max).arg(min).arg(avg));
  tone.setFont( QFont( "Helvetica", 10, QFont::Bold ) );
  tone.setColor( Qt::green );
  tone.setRenderFlags(Qt::AlignTop | Qt::AlignLeft);

  one->setLabel(tone);
  one->setValue(0, 10);
  one->setLabelAlignment(Qt::AlignBottom | Qt::AlignRight);

  QwtText ttwo(data->plotText());
  ttwo.setFont( QFont( "Helvetica", 10, QFont::Bold ) );
  ttwo.setColor( Qt::white );
  ttwo.setRenderFlags(Qt::AlignBottom | Qt::AlignRight);

  two->setLabel(ttwo);
  two->setValue(10, 10);
  two->setLabelAlignment(Qt::AlignBottom | Qt::AlignLeft);

  replot();
  repaint();
}
Beispiel #9
0
StPlot::StPlot(QWidget* parent): 
  QwtPlot(parent),
  viewFactor(-1.0)
{
  setMinimumHeight(10);
  setMinimumWidth(10);
  QwtPlotGrid *grid = new QwtPlotGrid;
  grid->enableXMin(true);
  grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
  grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
  grid->attach(this);
  setAxisTitle(QwtPlot::xBottom, "Czas [s]");
  setAxisTitle(QwtPlot::yLeft, "Amplituda [mv]");
  
  curve = new QwtPlotCurve("Filtered signal");
  curve->setYAxis(QwtPlot::yLeft);
  curve->attach(this);

  ISOPoints = new QwtPlotCurve("ISO");
  ISOPoints->setStyle(QwtPlotCurve::NoCurve);
  ISOPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::green), QColor(Qt::green), QSize(5, 5)));
  ISOPoints->setYAxis(QwtPlot::yLeft);
  ISOPoints->attach(this);
  
  JPoints = new QwtPlotCurve("J");
  JPoints->setStyle(QwtPlotCurve::NoCurve);
  JPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::blue), QColor(Qt::blue), QSize(5, 5)));
  JPoints->setYAxis(QwtPlot::yLeft);
  JPoints->attach(this);
  
  STPoints = new QwtPlotCurve("ST");
  STPoints->setStyle(QwtPlotCurve::NoCurve);
  STPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::red), QColor(Qt::red), QSize(5, 5)));
  STPoints->setYAxis(QwtPlot::yLeft);
  STPoints->attach(this);

  RPoints = new QwtPlotCurve("R");
  RPoints->setStyle(QwtPlotCurve::NoCurve);
  RPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::yellow), QColor(Qt::yellow), QSize(5, 5)));
  RPoints->setYAxis(QwtPlot::yLeft);
  //RPoints->attach(this);

  legend = new QwtLegend();
  legend->setItemMode(QwtLegend::ReadOnlyItem);
  legend->setWhatsThis("Click on an item to show/hide the plot");
  this->insertLegend(legend, QwtPlot::RightLegend);
  
  samples = new QVector<QPointF>;
  data = new QwtPointSeriesData;
  replot();
  
  zoomer = new QwtPlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, canvas());
  zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect4, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect5, Qt::NoButton);
  zoomer->setMousePattern(QwtEventPattern::MouseSelect6, Qt::NoButton);
}
Beispiel #10
0
void QcepPlot::updateZoomer()
{
  if (m_Zoomer && m_Zoomer -> zoomRectIndex() == 0) {
    m_Zoomer -> setZoomBase();
  }

  replot();
}
void
RealtimePlot::showSpeed(int state)
{
    showSpeedState = state;
    spdCurve->setVisible(state == Qt::Checked);
    enableAxis(yRight2, state == Qt::Checked);
    replot();
}
void
RealtimePlot::showCad(int state)
{
    showCadState = state;
    cadCurve->setVisible(state == Qt::Checked);
    enableAxis(yRight, showCadState == Qt::Checked || showHrState == Qt::Checked);
    replot();
}
void SurfPlot::push(std::vector<float> scores) {
   data[0] = 0.f;
   for (int i = 1; i < SURF_PLOT_SIZE - 1; ++i){
      if(i < (int)scores.size()+1) data[i] = scores[i-1];
      else data[i] = 0.f;
   }
   replot();
}
void PerformanceManagerWindow::configChanged()
{
    if (active) {
        days = 0; // force replot
        replot();
    }
    PMpicker->setRubberBandPen(GColor(CPLOTSELECT));
}
Beispiel #15
0
void Plot::setResampleMode( int mode )
{
    RasterData *data = static_cast<RasterData *>( d_spectrogram->data() );
    data->setResampleMode(
        static_cast<QwtMatrixRasterData::ResampleMode>( mode ) );

    replot();
}
Beispiel #16
0
void SaxsviewImage::setMajorTicksVisible(bool on) {
  for (int i = QwtPlot::yLeft; i < QwtPlot::axisCnt; ++i) {
    QwtScaleDraw *draw = p->scales[i]->scaleDraw();
    draw->setTickLength(QwtScaleDiv::MajorTick, on ? 8 : 0);
  }

  replot();
}
Beispiel #17
0
void Oscilloscope::on_new_data(double * d)
{
    for (int i = 0; i < channels;i++) {
        channel_data[i].erase(channel_data[i].begin());
        channel_data[i].push_back(d[i]);
    }
    replot();
}
Beispiel #18
0
void caStripPlot::setBackground(QColor c)
{
    thisBackColor = c;
    QPalette canvasPalette(c);
    canvasPalette.setColor(QPalette::Foreground, QColor(133, 190, 232));
    canvas()->setPalette(canvasPalette);
    replot();
}
Beispiel #19
0
void caStripPlot::showCurve(int number, bool on)
{
    if(number < 0 || number > (MAXCURVES-1)) return;
    curve[number]->setVisible(on);
    fillcurve[number]->setVisible(on);
    errorcurve[number]->setVisible(on);
    replot();
}
/*!
  This method is intended for manipulating the plot widget
  from a specific editor in the Qwt designer plugin.

  \warning The plot editor has never been implemented.
*/
void QwtPlot::applyProperties( const QString & /* xmlDocument */ )
{
#if 0
    // Temporary dummy code, for designer tests
    setTitle( xmlDocument );
    replot();
#endif
}
void
RealtimePlot::showAlt(int state)
{
    showAltState = state;
    altPwrCurve->setVisible(state == Qt::Checked);
    enableAxis(yLeft, showAltState == Qt::Checked || showPowerState == Qt::Checked || showPow30sState == Qt::Checked);
    replot();
}
Beispiel #22
0
void Plot::showSpectrogram( bool on )
{
    d_spectrogram->setDisplayMode( QwtPlotSpectrogram::ImageMode, on );
    d_spectrogram->setDefaultContourPen(
        on ? QPen( Qt::black, 0 ) : QPen( Qt::NoPen ) );

    replot();
}
Beispiel #23
0
void QwtGrapher::showCurve(QwtPlotItem *item, bool on) {
    item->setVisible(on);
    QWidget *w = legend()->find(item);
    if (w && w->inherits("QwtLegendItem") )
        ((QwtLegendItem *)w)->setChecked(on);

    replot();
}
void Spectrogramplot::setYAxisRange(double yMin, double yMax)
{
  yMin_ = yMin;
  yMax_ = yMax;
  data_->setInterval( Qt::YAxis, QwtInterval( yMin_, yMax_ ) );
  plotLayout()->setAlignCanvasToScales(true);
  replot();
}
void Spectrogramplot::setXAxisRange(double xMin, double xMax)
{
  xMin_ = xMin;
  xMax_ = xMax;
  data_->setInterval( Qt::XAxis, QwtInterval( xMin_, xMax_ ) );
  plotLayout()->setAlignCanvasToScales(true);
  replot();
}
Beispiel #26
0
void EEGPlot::replotManual()
{
	m_arraySeriesData->lockMutex();
	setAxisScale(QwtPlot::yLeft,m_arraySeriesData->minimumY(), m_arraySeriesData->maximumY(), m_arraySeriesData->maximumY()/4);
	setAxisScale(QwtPlot::xBottom,m_arraySeriesData->minimumX(), m_arraySeriesData->maximumX(),1.0);
	replot();
	m_arraySeriesData->unLockMutex();
}
Beispiel #27
0
void
BasicPlot::setAxes(double xmin, double xmax, double ymin, double ymax)
{
  setAxisScale(xBottom, xmin, xmax);
  setAxisScale(yLeft, ymin, ymax);
  replot();
  // set zoomer to new axes limits
  emit setNewBase(axisScaleDiv(QwtPlot::xBottom), axisScaleDiv(QwtPlot::yLeft));
}
Beispiel #28
0
void Curve::get_ele_max(int device_port,int ele_max)
{
    if(device_port != this->device_port){
        return ;
    }
    this->ele_max   = ele_max;

    replot();
}
Beispiel #29
0
//! Polish
void QwtPolarPlot::polish()
{
  updateLayout();
  replot();

#if QT_VERSION < 0x040000
  QWidget::polish();
#endif
}
Beispiel #30
0
void QCustomPlotExt::setMarkerValue(double value)
{
    if (marker)
    {
        markerValue = value;
        updateMarker();
        replot();
    }
}