void CurvesDialog::showCurveBtn(int)
{
	QwtPlotItem *it = d_graph->plotItem(contents->currentRow());
	if (!it)
		return;

    if (it->rtti() == QwtPlotItem::Rtti_PlotSpectrogram)
    {
        btnEditFunction->setEnabled(false);
        btnAssociations->setEnabled(false);
        btnRange->setEnabled(false);
        return;
    }

    PlotCurve *c = (PlotCurve *)it;
	if (c->type() == Graph::Function)
	{
		btnEditFunction->setEnabled(true);
		btnAssociations->setEnabled(false);
		btnRange->setEnabled(false);
		return;
	}

    btnAssociations->setEnabled(true);

    btnRange->setEnabled(true);
	if (c->type() == Graph::ErrorBars)
  		btnRange->setEnabled(false);
}
Exemple #2
0
void Fit::setDataCurve(int curve, double start, double end) {
  if (!d_graph)
    return;

  if (d_n > 0)
    delete[] d_w;

  Filter::setDataCurve(curve, start, end);

  d_w = new double[d_n];
  PlotCurve *plotCurve = dynamic_cast<PlotCurve *>(d_curve);
  DataCurve *dataCurve = dynamic_cast<DataCurve *>(d_curve);
  // if it is a DataCurve (coming from a Table)
  if (plotCurve && dataCurve && plotCurve->type() != GraphOptions::Function) {
    QList<DataCurve *> lst = dataCurve->errorBarsList();
    foreach (DataCurve *c, lst) {
      QwtErrorPlotCurve *er = dynamic_cast<QwtErrorPlotCurve *>(c);
      if (er && !er->xErrors()) {
        d_weighting = Instrumental;
        for (int i = 0; i < d_n; i++)
          d_w[i] = er->errorValue(i); // d_w are equal to the error bar values
        weighting_dataset = er->title().text();
        return;
      }
    }
void PlotScene::displayLabels(const QPointF& mousePos, const QPointF& scenePos)
{
    QPalette palette;
    PlotCurve* currentCurve = NULL;

    for (int i(0); i < this->curves.count(); i++)
    {
        currentCurve = this->curves.at(i);

        /* Get the CoordinateItem which abscisse is the nearest
         * to the mouse position abscisse */
        CoordinateItem* itemAtMousePos =
                currentCurve->nearestCoordinateitemsOfX(scenePos.x());

        if (itemAtMousePos == NULL) continue;

        // Get the label associate to the curve
        QLabel* curveLabel = this->curveLabels.at(i);
        if (curveLabel == NULL) continue;

        // Change the text color of the label associate to the curve
        palette.setColor(QPalette::WindowText, currentCurve->getPen().color());
        curveLabel->setPalette(palette);

        // Change the text of the label associate to the curve
        curveLabel->setText(QString("%1, %2").arg(
                                itemAtMousePos->x(), 6, 'f', 2).arg(
                                itemAtMousePos->y(), 6, 'f', 2));
        curveLabel->adjustSize();

        // Move the label
        curveLabel->move(mousePos.x(), mousePos.y() - (i * 12));
    }
}
Exemple #4
0
void PlotCurve::computeWaterfallOffsets()
{
  Plot *plot = static_cast<Plot *>(this->plot());
  Graph *g = static_cast<Graph *>(plot->parent());

  // reset the offsets
  d_x_offset = 0.0;
  d_y_offset = 0.0;

  if (g->isWaterfallPlot()){
    int index = g->curveIndex(this);
    int curves = g->curves();//Count();
    PlotCurve *c = dynamic_cast<PlotCurve*>(g->curve(0));
    // Get the minimum value of the first curve in this plot
    double ymin = c->minYValue();
    if (index > 0 && c){
      d_x_offset = index*g->waterfallXOffset()*0.01*plot->canvas()->width()/(double)(curves - 1);
      d_y_offset = index*g->waterfallYOffset()*0.01*plot->canvas()->height()/(double)(curves - 1);

      setZ(-index);
      setBaseline(ymin-d_y_offset); // Fill down to minimum value of first curve

    } else {
      setZ(0);
      setBaseline(ymin); // This is for when 'fill under curve' is turn on
    }
    if (g->grid())
      g->grid()->setZ(-g->curves()/*Count()*/ - 1);
  }
}
void PlotScene::highlightPoint(float timeValue, const QVariant &trackId)
{
    PlotCurve* targetPlotCurve = NULL;

    // Find the curve associate to trackId of the point selected on the mapping
    for(int i(0); targetPlotCurve == NULL && i < this->curves.count(); i++)
        if (this->curves.at(i)->id() == trackId)
            targetPlotCurve = this->curves[i];

    if (targetPlotCurve == NULL)
    {
        qDebug() << "No PlotCurve associate to the trackId found";
        return;
    }

    CoordinateItem* nearestCoord = targetPlotCurve->nearestCoord(timeValue);
    if (nearestCoord == NULL)
        return;

    TickItem* tick = new TickItem(true);
    tick->setPos(nearestCoord->pos());

    /* Create the group that will contain all the GraphicsItem corresponding
     * to the selected zone or point */
    if (this->selectedGroup == NULL)
    {
        this->selectedGroup = new QGraphicsItemGroup;
        this->addItem(this->selectedGroup);
    }

    this->selectedGroup->addToGroup(tick);
    tick->launchAnimation();
}
QString LegendWidget::parse(const QString& str)
{
    QString s = str;
    s.remove(QRegExp("\\l(*)", Qt::CaseSensitive, QRegExp::Wildcard));
    s.remove(QRegExp("\\p{*}", Qt::CaseSensitive, QRegExp::Wildcard));

	QString aux = str;
    while (aux.contains(QRegExp("%(*)", Qt::CaseInsensitive, QRegExp::Wildcard))){//curve name specification
		int pos = str.indexOf("%(", 0, Qt::CaseInsensitive);
        int pos2 = str.indexOf(")", pos, Qt::CaseInsensitive);
		QString spec = str.mid(pos + 2, pos2 - pos - 2);
		QStringList lst = spec.split(",");
		if (!lst.isEmpty()){
        	int cv = lst[0].toInt() - 1;
        	if (d_plot && cv >= 0 && cv < d_plot->curveCount()){
				PlotCurve *c = (PlotCurve *)d_plot->curve(cv);
            	if (c){
					if (lst.count() == 1)
						s = s.replace(pos, pos2-pos+1, c->title().text());
					else if (lst.count() == 3 && c->type() == Graph::Pie){
						Table *t = ((DataCurve *)c)->table();
						int col = t->colIndex(c->title().text());
						int row = lst[2].toInt() - 1;
						s = s.replace(pos, pos2-pos+1, t->text(row, col));
					}
				}
        	}
			aux = aux.right(aux.length() - pos2 - 1);
		}
    }
    return s;
}
void SmoothCurveDialog::activateCurve(int curveIndex)
{
	if (smooth_method == SmoothFilter::Average){
		PlotCurve *c = graph->curve(curveIndex);
		if (!c || c->rtti() != QwtPlotItem::Rtti_PlotCurve)
			return;

		boxPointsLeft->setMaxValue(c->dataSize()/2);
	}
}
void PlotScene::handleSelection(void)
{
    if (this->selectionLocked > 0)
        return;

    QList<QGraphicsItem*> items = this->selectedItems();

    /* On n'a sélectionné qu'un élément, ça n'est donc pas une selection
     * rectangulaire --> on a sélectionné un point
     */
    if (items.count() == 1)
    {
        CoordinateItem* coord = qgraphicsitem_cast<CoordinateItem*>(items.first());

        if (coord != NULL)
        {
            PlotCurve* parent = qgraphicsitem_cast<PlotCurve*>(coord->parentItem());

            if (parent != NULL)
                emit this->pointSelected(coord->index().toFloat(), parent->id());
        }
    }
    else if (items.count() > 1)
    {
        QMap< PlotCurve*, QPair<float, float> > intervalsBounds;

        foreach (QGraphicsItem* item, items)
        {
            CoordinateItem* coord = qgraphicsitem_cast<CoordinateItem*>(item);

            if (coord != NULL)
            {
                PlotCurve* parent = qgraphicsitem_cast<PlotCurve*>(coord->parentItem());

                if (parent != NULL)
                {
                    if (! intervalsBounds.contains(parent))
                    {
                        intervalsBounds[parent].first = coord->index().toFloat();
                        intervalsBounds[parent].second = coord->index().toFloat();
                    }
                    else
                    {
                        if (coord->index().toFloat() < intervalsBounds[parent].first)
                            intervalsBounds[parent].first = coord->index().toFloat();
                        else if (coord->index().toFloat() > intervalsBounds[parent].second)
                            intervalsBounds[parent].second = coord->index().toFloat();
                    }
                }
            }
        }
bool PlotScene::removeCurves(const QVariant& idTrack)
{
    PlotCurve* targetCurve;
    for (int i(0); i < this->curves.count(); ++i)
    {
        targetCurve = this->curves.at(i);

        if(targetCurve->id() == idTrack)
        {
            this->curves.removeAt(i);
            this->removeItem(targetCurve);
            delete targetCurve;
            return true;
        }
    }

    return false;
}
void PlotScene::highlightSector(float t1, float t2, const QVariant& trackId)
{
    qDebug() << "sector délimité sur mapping. Bornes : " << t1 << t2;

    PlotCurve* targetPlotCurve = NULL;

    // Find the curve associate to trackId of the point selected on the mapping
    for(int i(0); targetPlotCurve == NULL && i < this->curves.count(); i++)
        if (this->curves.at(i)->id() == trackId)
            targetPlotCurve = this->curves[i];

    if (targetPlotCurve == NULL)
    {
        qDebug() << "No PlotCurve associate to the trackId found";
        return;
    }

    /* Get the sector that contains all the points
     * corresponding to the time interval t1 to t2 */
    AnimateSectorItem* sect = targetPlotCurve->sectorOn(t1, t2);
    if (sect == NULL)
    {
        qDebug() << "impossible de déterminer le secteur correspondant "
                 << "à la sélection de la vue mapping";
        return;
    }

    // The sector will have the same color that the curve
    sect->setBrush(targetPlotCurve->getPen().brush());

    /* Create the group that will contain all the GraphicsItem corresponding
     * to the selected zone or point */
    if (this->selectedGroup == NULL)
    {
        this->selectedGroup = new QGraphicsItemGroup;
        this->addItem(this->selectedGroup);
    }

    this->selectedGroup->addToGroup(sect);
    sect->launchAnimation();
}
Exemple #11
0
/*!
 * \brief PlotPicker::trackerText
 * Reimplentation of QwtPlotPicker::trackerText()
 * Only shows the tooltip when we have a curve at mouse position.
 * \param pos
 * \return
 */
QwtText PlotPicker::trackerText(const QPoint &pos) const
{
  int index = -1;
  PlotCurve *pPlotCurve = 0;
  if (curveAtPosition(pos, pPlotCurve, index)) {
    mpPointMarker->setValue(pPlotCurve->mXAxisVector.at(index), pPlotCurve->mYAxisVector.at(index));
    mpPointMarker->setVisible(true);
    QString timeUnit = "";
    if (!mpPlot->getParentPlotWindow()->getTimeUnit().isEmpty()) {
      timeUnit = QString("%1").arg(mpPlot->getParentPlotWindow()->getTimeUnit());
    }
    QString toolTip = QString("Name: <b>%1</b> %2<br />Value: <b>%3</b> at <b>%4</b> %5<br />Filename: <b>%6</b>")
        .arg(pPlotCurve->getName()).arg(pPlotCurve->getDisplayUnit())
        .arg(pPlotCurve->mYAxisVector.at(index))
        .arg(pPlotCurve->mXAxisVector.at(index))
        .arg(timeUnit)
        .arg(pPlotCurve->getFileName());
    QToolTip::showText(canvas()->mapToGlobal(pos), toolTip, nullptr);
  } else {
    mpPointMarker->setVisible(false);
    QToolTip::hideText();
  }
  return QString("");
}
Exemple #12
0
/**
 * Returns the index of the closest curve to a point on the canvas.
 * Also returns index of the nearest data point on that curve.
 * @param xpos :: x coordinate of a point on the canvas in pixels.
 * @param ypos :: y coordinate of a point on the canvas in pixels.
 * @param dist :: ?
 * @param point :: Output index of the nearest data point to the point with coordinates (xpos,ypos)
 */
int Plot::closestCurve(int xpos, int ypos, int &dist, int &point)
{
	QwtScaleMap map[QwtPlot::axisCnt];
	for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
		map[axis] = canvasMap(axis);

  double dmin = std::numeric_limits<double>::max();
	int key = -1;
	for (QMap<int, QwtPlotItem *>::iterator iter = d_curves.begin(); iter != d_curves.end(); ++iter )
	{
		QwtPlotItem *item = (QwtPlotItem *)iter.data();
		if (!item)
			continue;

    if(item->rtti() != QwtPlotItem::Rtti_PlotSpectrogram)
    {
      PlotCurve *c = (PlotCurve *)item;
      DataCurve *dc = dynamic_cast<DataCurve *>(item);
      if (dc)
      {
        if (c->type() != Graph::Function && dc->hasLabels() &&
          dc->selectedLabels(QPoint(xpos, ypos))){
            dist = 0;
            return iter.key();
        } else
          dc->setLabelsSelected(false);
      }

      for (int i=0; i<c->dataSize(); i++)
      {
        double cx = map[c->xAxis()].xTransform(c->x(i)) - double(xpos);
        double cy = map[c->yAxis()].xTransform(c->y(i)) - double(ypos);
        double f = qwtSqr(cx) + qwtSqr(cy);
        if (f < dmin && c->type() != Graph::ErrorBars)
        {
          dmin = f;
          key = iter.key();
          point = i;
        }
      }
    }
  }
	dist = static_cast<int>(sqrt(dmin));
	return key;
}
Exemple #13
0
PlotCurve::PlotCurve(const PlotCurve &c)
    : QObject(), QwtPlotCurve(c.title().text()), d_type(c.d_type),
      d_x_offset(c.d_x_offset), d_y_offset(c.d_y_offset),
      d_side_lines(c.d_side_lines), d_skip_symbols(c.d_skip_symbols),
      m_isDistribution(c.m_isDistribution) {}
Exemple #14
0
  void XMLParser::traverseGraphCell( Cell *parent, QDomElement &element )
  {


    // Get the style value
    QString style = element.attribute( XML_STYLE, "Graph" );
    // create inputcell with the saved style
    Cell *graphcell = factory_->createCell( style, parent );

    graphcell->setStyle(QString("Input"));
    //    graphcell->setStyle(style);


    // go through all children in input cell/element
    QString text;
    QDomNode node = element.firstChild();
    while( !node.isNull() )
    {
      QDomElement e = node.toElement();
      if( !e.isNull() )
      {
        if( e.tagName() == XML_INPUTPART )
        {
          text = e.text();
          GraphCell *gCell = dynamic_cast<GraphCell*>(graphcell);
          gCell->setText(text);
        }
        else if( e.tagName() == XML_OUTPUTPART )
        {
          GraphCell *iCell = dynamic_cast<GraphCell*>(graphcell);
          iCell->setTextOutput( e.text() );
        }
        else if( e.tagName() == XML_IMAGE )
        {
          addImage( graphcell, e );
        }
        else if( e.tagName() == XML_RULE )
        {
          graphcell->addRule(
            new Rule( e.attribute( XML_NAME, "" ), e.text() ));
        }
        else if( e.tagName() == XML_GRAPHCELL_DATA ) {}
        else if( e.tagName() == XML_GRAPHCELL_GRAPH ) {}
        else if( e.tagName() == XML_GRAPHCELL_SHAPE ) {}
        else if( e.tagName() == XML_GRAPHCELL_OMCPLOT )
        {
          GraphCell *gCell = dynamic_cast<GraphCell*>(graphcell);
          // read attributes and set the plotwindow values
          gCell->mpPlotWindow->setTitle(e.attribute(XML_GRAPHCELL_TITLE));
          gCell->mpPlotWindow->setGrid(e.attribute(XML_GRAPHCELL_GRID));
          int type = e.attribute(XML_GRAPHCELL_PLOTTYPE).toInt();
          if (type == 1)
            gCell->mpPlotWindow->setPlotType(PlotWindow::PLOTALL);
          else if (type == 2)
            gCell->mpPlotWindow->setPlotType(PlotWindow::PLOTPARAMETRIC);
          else
            gCell->mpPlotWindow->setPlotType(PlotWindow::PLOT);
          gCell->mpPlotWindow->setLogX((e.attribute(XML_GRAPHCELL_LOGX) == XML_TRUE) ? true : false);
          gCell->mpPlotWindow->setLogY((e.attribute(XML_GRAPHCELL_LOGY) == XML_TRUE) ? true : false);
          gCell->mpPlotWindow->setXRange(e.attribute(XML_GRAPHCELL_XRANGE_MIN).toDouble(), e.attribute(XML_GRAPHCELL_XRANGE_MAX).toDouble());
          gCell->mpPlotWindow->setYRange(e.attribute(XML_GRAPHCELL_YRANGE_MIN).toDouble(), e.attribute(XML_GRAPHCELL_YRANGE_MAX).toDouble());
          gCell->mpPlotWindow->setXLabel(e.attribute(XML_GRAPHCELL_XLABEL));
          gCell->mpPlotWindow->setYLabel(e.attribute(XML_GRAPHCELL_YLABEL));
          gCell->mpPlotWindow->setCurveWidth(e.attribute(XML_GRAPHCELL_CURVE_WIDTH).toDouble());
          gCell->mpPlotWindow->setCurveStyle(e.attribute(XML_GRAPHCELL_CURVE_STYLE).toDouble());
          gCell->mpPlotWindow->setLegendPosition(e.attribute(XML_GRAPHCELL_LEGENDPOSITION));
          gCell->mpPlotWindow->setFooter(e.attribute(XML_GRAPHCELL_FOOTER));
          gCell->mpPlotWindow->setAutoScale((e.attribute(XML_GRAPHCELL_AUTOSCALE) == XML_TRUE) ? true : false);
          // read curves
          for (QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling())
          {
            QDomElement curveElement = n.toElement();
            if (curveElement.tagName() == XML_GRAPHCELL_CURVE)
            {
              PlotCurve *pPlotCurve = new PlotCurve("", curveElement.attribute(XML_GRAPHCELL_TITLE), "", gCell->mpPlotWindow->getPlot());
              // read the curve data
              if (curveElement.hasAttribute(XML_GRAPHCELL_XDATA) && curveElement.hasAttribute(XML_GRAPHCELL_YDATA))
              {
                QByteArray xByteArray = QByteArray::fromBase64(curveElement.attribute(XML_GRAPHCELL_XDATA).toStdString().c_str());
                QDataStream xInStream(xByteArray);
                while (!xInStream.atEnd())
                {
                  double d;
                  xInStream >> d;
                  pPlotCurve->addXAxisValue(d);
                }
                QByteArray yByteArray = QByteArray::fromBase64(curveElement.attribute(XML_GRAPHCELL_YDATA).toStdString().c_str());
                QDataStream yInStream(yByteArray);
                while (!yInStream.atEnd())
                {
                  double d;
                  yInStream >> d;
                  pPlotCurve->addYAxisValue(d);
                }
                // set the curve data
                pPlotCurve->setData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(), pPlotCurve->getSize());
              }
              gCell->mpPlotWindow->getPlot()->addPlotCurve(pPlotCurve);
              pPlotCurve->attach(gCell->mpPlotWindow->getPlot());
              // read the curve attributes
              pPlotCurve->setCustomColor(true);
              QPen customPen = pPlotCurve->pen();
              customPen.setColor(curveElement.attribute(XML_GRAPHCELL_COLOR).toUInt());
              customPen.setWidthF(gCell->mpPlotWindow->getCurveWidth());
              customPen.setStyle(pPlotCurve->getPenStyle(gCell->mpPlotWindow->getCurveStyle()));
              pPlotCurve->setPen(customPen);
              if (gCell->mpPlotWindow->getCurveStyle() > 5)
                pPlotCurve->setStyle(pPlotCurve->getCurveStyle(gCell->mpPlotWindow->getCurveStyle()));
              if (gCell->mpPlotWindow->getPlot()->legend())
              {
                if (curveElement.attribute(XML_GRAPHCELL_VISIBLE) == XML_FALSE)
                {
                  pPlotCurve->setVisible(false);
                }
              }
            }
          }
          gCell->mpPlotWindow->show();
          gCell->mpPlotWindow->fitInView();
          gCell->mpPlotWindow->getPlot()->getPlotZoomer()->setZoomBase(false);
        }
Exemple #15
0
int LegendWidget::symbolsMaxWidth()
{
  QList<int> cvs = d_plot->curveKeys();
  int curves = cvs.count();
  if (!curves)
    return 0;

  // RJT (22/09/09): For rest of method, copied in code from current 
  // QtiPlot (rev. 1373) to fix infinite loop if closing bracket missing
  int maxL = 0;
  QString text = d_text->text();
  QStringList titles = text.split("\n", QString::KeepEmptyParts);
  for (int i=0; i<(int)titles.count(); i++){
    QString s = titles[i];
    while (s.contains("\\l(",Qt::CaseInsensitive)){
      int pos = s.indexOf("\\l(", 0,Qt::CaseInsensitive);
      int pos1 = s.indexOf("(", pos);
      int pos2 = s.indexOf(")", pos1);
      int pos3 = s.indexOf(",",pos1);
      if (pos3 != -1 && pos3 < pos2 ) pos2=pos3; // for pi charts get dataset number
      if (pos2 == -1){
        s = s.right(s.length() - pos1 - 1);
        continue;
      }

      int point = 0;
      PlotCurve* c = getCurve(s.mid(pos1 + 1, pos2 - pos1 - 1), point);
      if (c && c->type() == Graph::Pie){
        maxL = 2*d_text->font().pointSize();//10;
        line_length = 0;
        s = s.right(s.length() - pos2 - 1);
        continue;
      }

      if (c && c->rtti() != QwtPlotItem::Rtti_PlotSpectrogram) {
        if (c->type() == Graph::Pie ||
          c->type() == Graph::VerticalBars ||
          c->type() == Graph::HorizontalBars ||
          c->type() == Graph::Histogram ||
          c->type() == Graph::Box){
          maxL = 2*d_text->font().pointSize();//10;
          line_length = 0;
        } else {
          int l = c->symbol().size().width();
          if (l < 3)
            l = 3;
          else if (l > 15)
            l = 15;
          if (l>maxL && c->symbol().style() != QwtSymbol::NoSymbol)
            maxL = l;
        }
      }
      s = s.right(s.length() - pos2 - 1);
    }

    if (titles[i].contains("\\p{")){ // old syntax for pie charts
      maxL = 2*d_text->font().pointSize();//10;
      line_length = 0;
    }
  }
  return maxL;
}
Exemple #16
0
void FFT::outputGraphs()
{
	createOutputGraph();

	MultiLayer *ml = d_output_graph->multiLayer();

	d_output_graph->setTitle(QString::null);
	d_output_graph->setYAxisTitle(tr("Angle (deg)"));
	d_output_graph->enableAxis(QwtPlot::xTop, true);
	d_output_graph->enableAxis(QwtPlot::yRight, true);
	if (!d_inverse)
		d_output_graph->setAxisTitle(QwtPlot::xTop, tr("Frequency") + " (" + tr("Hz") + ")");
	else
		d_output_graph->setAxisTitle(QwtPlot::xTop, tr("Time") + + " (" + tr("s") + ")");

	ScaleDraw *sd = (ScaleDraw *)d_output_graph->axisScaleDraw(QwtPlot::yLeft);
	if (sd)
		sd->setShowTicksPolicy(ScaleDraw::HideBegin);
	sd = (ScaleDraw *)d_output_graph->axisScaleDraw(QwtPlot::yRight);
	if (sd)
		sd->setShowTicksPolicy(ScaleDraw::HideBegin);
	sd = (ScaleDraw *)d_output_graph->axisScaleDraw(QwtPlot::xBottom);
	if (sd){
		sd->setShowTicksPolicy(ScaleDraw::HideBeginEnd);
		sd->enableComponent(QwtAbstractScaleDraw::Backbone, false);
	}

	QString tableName = d_result_table->objectName();
	PlotCurve *pc = d_output_graph->insertCurve(d_result_table, 0, tableName + "_" + tr("Angle"), 0);
	pc->setPen(QPen(d_curveColor, 1));
	d_output_graph->removeLegend();
	d_output_graph->updatePlot();

	Graph *g = ml->addLayer(0, 0, 0, 0, true);
	g->setTitle(QString::null);
	if (!d_inverse)
		g->setXAxisTitle(tr("Frequency") + " (" + tr("Hz") + ")");
	else
		g->setXAxisTitle(tr("Time") + + " (" + tr("s") + ")");
	g->setYAxisTitle(tr("Amplitude"));
	g->removeLegend();

	sd = (ScaleDraw *)g->axisScaleDraw(QwtPlot::xTop);
	if (sd)
		sd->setShowTicksPolicy(ScaleDraw::HideBeginEnd);

	PlotCurve *c = g->insertCurve(d_result_table, 0, tableName + "_" + tr("Amplitude"), 0);
	c->setPen(QPen(d_curveColor, 1));
	g->updatePlot();

	double rb = g->axisScaleDiv(QwtPlot::xBottom)->upperBound();
	d_output_graph->setAxisScale(QwtPlot::xBottom, 0, rb);
	d_output_graph->setAxisScale(QwtPlot::xTop, 0, rb);
	g->setAxisScale(QwtPlot::xBottom, 0, rb);
	g->setAxisScale(QwtPlot::xTop, 0, rb);

	ml->setAlignPolicy(MultiLayer::AlignCanvases);
	ml->setRows(2);
	ml->setCols(1);
	ml->setSpacing(0, 0);
	ml->linkXLayerAxes();
	ml->setCommonLayerAxes(false, true);
	ml->arrangeLayers(false, false);
}