diff --git a/SimFigure/source/simfigure.cpp b/SimFigure/source/simfigure.cpp index ff6e46977..ed29076be 100644 --- a/SimFigure/source/simfigure.cpp +++ b/SimFigure/source/simfigure.cpp @@ -389,6 +389,21 @@ void SimFigure::rescale(void) m_plot->setAxisScale(QwtPlot::yLeft, 1, 100); m_plot->setAxisScale(QwtPlot::xBottom, 1, 100); } + +} + +/*! set limits for x axis (private) */ +void SimFigure::setXLim(double xmin, double xmax) +{ + m_plot->setAxisScale(QwtPlot::xBottom, xmin, xmax); + m_plot->replot(); +} + +/*! set limits for y axis (private) */ +void SimFigure::setYLim(double ymin, double ymax) +{ + m_plot->setAxisScale(QwtPlot::yLeft, ymin, ymax); + m_plot->replot(); } /*! Regenerate th egrid with new settings (Type, limits) - (private) */ @@ -912,7 +927,36 @@ void SimFigure::setLineStyle(QwtPlotCurve *curve, LineType lt) */ SimFigure::Marker SimFigure::marker(int ID) { - + if (ID > 0 && m_curves.length() <= ID && m_curves.value(ID-1) != nullptr) + { + const QwtSymbol *sym = m_curves.value(ID-1)->symbol(); + int mk = sym->style(); + switch (mk) { + case QwtSymbol::NoSymbol: + return Marker::None; + case QwtSymbol::XCross: + return Marker::Ex; + case QwtSymbol::Rect: + return Marker::Box; + case QwtSymbol::Cross: + return Marker::Plus; + case QwtSymbol::Ellipse: + return Marker::Circle; + case QwtSymbol::Star1: + return Marker::Asterisk; + case QwtSymbol::Triangle: + return Marker::Triangle; + case QwtSymbol::DTriangle: + return Marker::DownTriangle; + case QwtSymbol::LTriangle: + return Marker::LeftTriangle; + case QwtSymbol::RTriangle: + return Marker::RightTriangle; + } + } + else { + return Marker::None; + } } /** diff --git a/SimFigure/source/simfigure.h b/SimFigure/source/simfigure.h index 05c6558c9..cae22f1cb 100644 --- a/SimFigure/source/simfigure.h +++ b/SimFigure/source/simfigure.h @@ -112,6 +112,7 @@ class SimFigure : public QFrame int plot(QVector &, QVector &, LineType lt = LineType::Solid, QColor col = Qt::red, Marker mk = Marker::None); int scatter(QVector &, QVector &, QColor col = Qt::blue, Marker mk = Marker::Circle); + void clear(void); void cla(void); @@ -136,6 +137,8 @@ class SimFigure : public QFrame void setXLabel(QString lbl); void setYLabel(QString lbl); + void setXLim(double xmin, double xmax); + void setYLim(double ymin, double ymax); void setLabelFontSize(int); void setTitle(QString title); void setTitleFontSize(int);