28 #include <QtCore/QList> 29 #include <QtCore/QMap> 31 #include <QtGui/QBrush> 32 #include <QGraphicsEllipseItem> 33 #include <QtCore/QMutex> 35 #include <QPushButton> 36 #include <QtCore/QTime> 53 UPlotItem(qreal dataX, qreal dataY, qreal width=2);
63 void setData(
const QPointF & data);
98 UPlotCurve(
const QString & name, QObject * parent = 0);
102 UPlotCurve(
const QString & name,
const QVector<UPlotItem *>
data, QObject * parent = 0);
106 UPlotCurve(
const QString & name,
const QVector<float> &
x,
const QVector<float> &
y, QObject * parent = 0);
112 const QPen &
pen()
const {
return _pen;}
116 const QBrush &
brush()
const {
return _brush;}
121 void setPen(
const QPen & pen);
125 void setBrush(
const QBrush & brush);
130 QString
name()
const {
return _name;}
134 int itemsSize()
const;
135 QPointF getItemData(
int index);
137 void setData(QVector<UPlotItem*> & data);
138 void setData(
const QVector<float> & x,
const QVector<float> & y);
139 void setData(
const std::vector<float> & x,
const std::vector<float> & y);
140 void setData(
const QVector<float> & y);
141 void setData(
const std::vector<float> & y);
142 void getData(QVector<float> & x, QVector<float> & y)
const;
143 void draw(QPainter * painter);
150 virtual void clear();
155 void setVisible(
bool visible);
165 void setXStart(
float val);
176 void addValue(
float y);
181 void addValue(
float x,
float y);
188 void addValue(
const QString & y);
194 void addValues(QVector<UPlotItem *> & data);
199 void addValues(
const QVector<float> & xs,
const QVector<float> & ys);
205 void addValues(
const QVector<float> & ys);
206 void addValues(
const QVector<int> & ys);
212 void addValues(
const std::vector<float> & ys);
213 void addValues(
const std::vector<int> & ys);
224 void attach(
UPlot * plot);
225 void detach(
UPlot * plot);
227 const QVector<float> &
getMinMax()
const {
return _minMax;}
228 int removeItem(
int index);
231 virtual void update(
float scaleX,
float scaleY,
float offsetX,
float offsetY,
float xDir,
float yDir,
bool allDataKept);
261 UPlotCurveThreshold(
const QString & name,
float thesholdValue, Qt::Orientation orientation = Qt::Horizontal, QObject * parent = 0);
268 void setThreshold(
float threshold);
272 void setOrientation(Qt::Orientation orientation);
276 virtual void update(
float scaleX,
float scaleY,
float offsetX,
float offsetY,
float xDir,
float yDir,
bool allDataKept);
292 UPlotAxis(Qt::Orientation orientation = Qt::Horizontal,
float min=0,
float max=1, QWidget * parent = 0);
300 void setAxis(
float &
min,
float & max);
308 int step()
const {
return _step;}
316 void setReversed(
bool reversed);
319 virtual void paintEvent(QPaintEvent * event);
352 virtual void contextMenuEvent(QContextMenuEvent * event);
377 void setFlat(
bool on);
380 QPixmap createSymbol(
const QPen & pen,
const QBrush & brush);
384 void removeLegendItem(
const UPlotCurve * curve);
387 void legendItemRemoved(
const UPlotCurve * curve);
388 void legendItemToggled(
const UPlotCurve * curve,
bool toggled);
391 virtual void contextMenuEvent(QContextMenuEvent * event);
394 void redirectToggled(
bool);
414 UOrientableLabel(
const QString & text, Qt::Orientation orientation = Qt::Horizontal, QWidget * parent = 0);
423 void setOrientation(Qt::Orientation orientation);
424 QSize sizeHint()
const;
425 QSize minimumSizeHint()
const;
427 virtual void paintEvent(QPaintEvent* event);
470 UPlot(QWidget * parent = 0);
476 UPlotCurve * addCurve(
const QString & curveName,
const QColor & color = QColor());
480 bool addCurve(
UPlotCurve * curve,
bool ownershipTransferred =
true);
484 QStringList curveNames();
485 bool contains(
const QString & curveName);
490 UPlotCurveThreshold * addThreshold(
const QString & name,
float value, Qt::Orientation orientation = Qt::Horizontal);
491 QString
title()
const {
return this->objectName();}
492 QPen getRandomPenColored();
493 void showLegend(
bool shown);
494 void showGrid(
bool shown);
495 void showRefreshRate(
bool shown);
496 void keepAllData(
bool kept);
497 void showXAxis(
bool shown) {_horizontalAxis->setVisible(shown);}
498 void showYAxis(
bool shown) {_verticalAxis->setVisible(shown);}
501 void setFixedXAxis(
float x1,
float x2);
502 void setFixedYAxis(
float y1,
float y2);
503 void setMaxVisibleItems(
int maxVisibleItems);
504 void setTitle(
const QString & text);
505 void setXLabel(
const QString & text);
506 void setYLabel(
const QString & text, Qt::Orientation orientation = Qt::Vertical);
507 void setWorkingDirectory(
const QString & workingDirectory);
508 void setGraphicsView(
bool on);
509 QRectF sceneRect()
const;
517 void showCurve(
const UPlotCurve * curve,
bool shown);
526 void captureScreen();
530 virtual void contextMenuEvent(QContextMenuEvent * event);
531 virtual void paintEvent(QPaintEvent * event);
532 virtual void resizeEvent(QResizeEvent * event);
536 void addItem(QGraphicsItem * item);
539 void replot(QPainter * painter);
540 bool updateAxis(
float x,
float y);
541 bool updateAxis(
float x1,
float x2,
float y1,
float y2);
543 void createActions();
545 void selectScreenCaptureFormat();
552 float _axisMaximums[4];
553 bool _axisMaximumsSet[4];
QString _autoScreenCaptureFormat
QGraphicsTextItem * _text
const QVector< float > & getMinMax() const
QGraphicsItem * _sceneRoot
UPlotAxis * _verticalAxis
QList< UPlotCurve * > _curves
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
const UPlotCurve * _curve
QAction * _aAddVerticalLine
UPlotItem * _previousItem
UOrientableLabel * _yLabel
QWidget * _graphicsViewHolder
Qt::Orientation _orientation
QTime _refreshIntervalTime
TFSIMD_FORCE_INLINE const tfScalar & y() const
UPlotItem * previousItem() const
QString _workingDirectory
const QBrush & brush() const
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
void showYAxis(bool shown)
UPlotAxis * _horizontalAxis
virtual void showDescription(bool shown)
const QPointF & data() const
virtual bool isMinMaxValid() const
Qt::Orientation _orientation
QAction * _aShowRefreshRate
UPlotItem(qreal dataX, qreal dataY, qreal width=2)
QAction * _aAddHorizontalLine
TFSIMD_FORCE_INLINE const tfScalar & x() const
virtual void keyReleaseEvent(QKeyEvent *keyEvent)
QList< QGraphicsItem * > _items
virtual bool isMinMaxValid() const
QAction * _aYLabelVertical
QList< QGraphicsLineItem * > vGridLines
QAction * _aCopyToClipboard
QAction * _aAutoScreenCapture
virtual void focusOutEvent(QFocusEvent *event)
void setData(const QPointF &data)
Qt::Orientation orientation() const
UPlotItem * nextItem() const
virtual void focusInEvent(QFocusEvent *event)
QAction * _aUseFlatButtons
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
const UPlotCurve * curve() const
void showXAxis(bool shown)
void setNextItem(UPlotItem *nextItem)
QList< QGraphicsLineItem * > hGridLines
Qt::Orientation _orientation
void increment(int *value)
void setPreviousItem(UPlotItem *previousItem)