mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-26 10:31:39 +08:00
added function to JKQTPPlotElement that allow to transform a complete vector of x- or y-values in one call
This commit is contained in:
parent
56d59b1760
commit
1363cf7012
@ -239,6 +239,25 @@ double JKQTPPlotElement::transformY(double y) const {
|
|||||||
return parent->getYAxis()->x2p(y);
|
return parent->getYAxis()->x2p(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<double> JKQTPPlotElement::transformX(const QVector<double>& x) const {
|
||||||
|
QVector<double> res;
|
||||||
|
res.resize(x.size());
|
||||||
|
for (int i=0; i<x.size(); i++) {
|
||||||
|
res[i]=parent->getXAxis()->x2p(x[i]);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<double> JKQTPPlotElement::transformY(const QVector<double>& y) const {
|
||||||
|
QVector<double> res;
|
||||||
|
res.resize(y.size());
|
||||||
|
for (int i=0; i<y.size(); i++) {
|
||||||
|
res[i]=parent->getYAxis()->x2p(y[i]);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double JKQTPPlotElement::backtransformX(double x) const {
|
double JKQTPPlotElement::backtransformX(double x) const {
|
||||||
return parent->getXAxis()->p2x(x);
|
return parent->getXAxis()->p2x(x);
|
||||||
}
|
}
|
||||||
|
@ -244,6 +244,11 @@ class JKQTP_LIB_EXPORT JKQTPPlotElement: public QObject {
|
|||||||
return QPolygonF(transform(x));
|
return QPolygonF(transform(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief transform all x-coordinates in a vector \a x */
|
||||||
|
QVector<double> transformX(const QVector<double>& x) const;
|
||||||
|
/** \brief transform all y-coordinates in a vector \a x */
|
||||||
|
QVector<double> transformY(const QVector<double>& x) const;
|
||||||
|
|
||||||
|
|
||||||
/** \brief clear the internal datastore for hitTest()
|
/** \brief clear the internal datastore for hitTest()
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user