WebLVC 1.8 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
progressiveLineGraph.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2017 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <portalApp/dllExport.h>
13 
14 #include <QtCore/QObject>
15 #include <QtCore/QPair>
16 #include <QtCore/QMap>
17 #include <QWidget>
18 #include <QPixmap>
19 #include <QImage>
20 #include <QPen>
21 
22 #include <utility>
23 #include <list>
24 
25 
26 class QPainter;
27 
28 
34 { Q_OBJECT;
35 public:
36 
38  DtProgressiveLineGraph( int rangeMin, int rangeMax, bool autoScale, QWidget* parent );
39 
41  virtual ~DtProgressiveLineGraph();
42 
44  void addSet( int set, QPen pen, int initial, bool valueCentered = false );
45 
47  void insertValue( int set, double percent, int value );
48 
50  virtual void resetAllValues( int value );
51 
53  virtual void resetValues( int set, int value );
54 
56  virtual void clearValues( int set );
57 
59  virtual void clearAllValues();
60 
63  virtual void offsetPercentages( double percentOffset );
64 
67  virtual void offsetPercentages( int set, double percentOffset );
68 
71  virtual void setRange( int min, int max );
72 
74  virtual int rangeMinimum() const;
75  virtual int rangeMaximum() const;
76 
79  virtual bool autoScale() const;
80 
83  virtual void setAutoScale( bool value );
84 
86  virtual void setNegativeReflection( bool positive );
87 
89  virtual void useBackgroundGradient( bool useIt );
90 
92  virtual bool usesBackgroundGradient() const;
93 
96  virtual void drawAsVerticalLines( bool useVerticalLines );
97 
100  virtual bool usesVerticalLines() const;
101 
103  void forceUpdate( bool widgetUpdate );
104 
105 protected:
106 
107  typedef std::list< std::pair<double,int> > PercentValueMap;
108 
109  struct Set
110  {
112  QPen myPen;
114  int myMax;
115  int myMin;
116  };
117 
118  typedef std::map<int,DtProgressiveLineGraph::Set*> SetMap;
119 
121  virtual void resizeEvent( QResizeEvent* e );
122 
124  virtual void paintEvent( QPaintEvent* );
125 
127  virtual void draw( QPainter& painter, const QRect& rect );
128 
130  virtual void paintBackground( QPainter& painter );
131 
133  virtual int getSeparation() const;
134 
136  virtual void paintLines( QPainter& painter, Set& set );
137 
139  virtual int desiredRange() const;
140 
142  void paintVerticalLines( PercentValueMap& set, QRectF svp,
143  int rangeHeight, QPainter& painter, QPen pen, bool centered);
144 
146  void paintConnectedLines( PercentValueMap& set, QRectF svp,
147  int rangeHeight, QPainter& painter, QPen pen );
148 
150  int desiredMinimum() const;
151 
154 
158  bool myActive;
159 
161  QPixmap myGradBack;
162  QPixmap* myLineBuffer;
163  QPolygon* myPointCache;
164 
170 
171 };
int myMax
Definition: progressiveLineGraph.h:114
std::map< int, DtProgressiveLineGraph::Set * > SetMap
Definition: progressiveLineGraph.h:118
bool myNegativeReflection
Definition: progressiveLineGraph.h:169
std::list< std::pair< double, int > > PercentValueMap
Definition: progressiveLineGraph.h:107
int myMaximumRange
Definition: progressiveLineGraph.h:156
bool myUseCachedGraph
Definition: progressiveLineGraph.h:165
QPixmap * myLineBuffer
Definition: progressiveLineGraph.h:162
int myInitialMinimumRange
Definition: progressiveLineGraph.h:152
int myInitialMaximumRange
Definition: progressiveLineGraph.h:153
bool myValuesCentered
Definition: progressiveLineGraph.h:113
int myMin
Definition: progressiveLineGraph.h:115
SetMap mySets
Definition: progressiveLineGraph.h:160
bool myGraphNeedsUpdating
Definition: progressiveLineGraph.h:167
#define DT_DLL_LIBPORTALAPP
Definition: include/portalApp/dllExport.h:20
PercentValueMap myValues
Definition: progressiveLineGraph.h:111
bool myAutoScale
Definition: progressiveLineGraph.h:157
Widget which draws a line graphic where the data is progressively added over time.
Definition: progressiveLineGraph.h:33
bool myUseGradient
Definition: progressiveLineGraph.h:166
bool myActive
Definition: progressiveLineGraph.h:158
QPixmap myGradBack
Definition: progressiveLineGraph.h:161
QPolygon * myPointCache
Definition: progressiveLineGraph.h:163
Definition: progressiveLineGraph.h:109
QPen myPen
Definition: progressiveLineGraph.h:112
int myMinimumRange
Definition: progressiveLineGraph.h:155
bool myUseVerticalLines
Definition: progressiveLineGraph.h:168

Document ID: Generated on Wed Mar 12 15:05:17 EDT 2025 from SVN revision 274272
Copyright © 2005-2025 MAK Technologies. All Rights Reserved (www.mak.com)