QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qvplot.h
1 /* QVisu (c) 2015 Maximilian Gauger mgauger@kalassi.de
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12 
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef QVPLOT_H
18 #define QVPLOT_H
19 
20 #include <QLabel>
21 #include "../qvelement.h"
22 #include "../qvsvgwidget.h"
23 #include "../qviconwidget.h"
24 
25 class series_t {
26 public:
27  QString name, type;
28  int axis;
29  QString color;
30  QMap<double,double> data;
31 };
32 
33 class QVPlot : public QVElement
34 {
35  Q_OBJECT
36 public:
37  explicit QVPlot(QDomElement xml_desc, QString container, QWidget *parent = 0);
38  void resizeEvent(QResizeEvent*);
39  void mousePressEvent(QMouseEvent*);
40 
41 public slots:
42  void onInitCompleted();
43  void onSeriesReceived(QString,QMap<double,double>);
44 
45 private:
46  void redrawSeries();
47  void addPlot(QDomElement xml_elem, int axis);
48 
49  QMap<QString,series_t*> series;
50  QVSvgWidget *plot_widget;
51  QLabel *w_title;
52  QVIconWidget *w_icon;
53 
54  QString series_start;
55  double axis1_min, axis1_max, axis2_min, axis2_max;
56  bool has_axis1, has_axis2;
57  bool grid1, grid2, xgrid;
58  bool common_zero;
59 
60  static const int label_size = 12;
61  static const int padding = 6;
62  QString background_color;
63 };
64 
65 #endif // QVPLOT_H
Definition: qviconwidget.h:26
Definition: qvplot.h:25
void resizeEvent(QResizeEvent *)
Definition: qvplot.cpp:166
Definition: qvelement.h:34
Definition: qvplot.h:33
Definition: qvsvgwidget.h:24
QString container
Definition: qvelement.h:73