qwt_plot.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_PLOT_H
11 #define QWT_PLOT_H
12 
13 #include "qwt_global.h"
14 #include "qwt_axis_id.h"
15 #include "qwt_plot_dict.h"
16 
17 #include <qframe.h>
18 
19 class QwtPlotLayout;
20 class QwtAbstractLegend;
21 class QwtScaleWidget;
22 class QwtScaleEngine;
23 class QwtScaleDiv;
24 class QwtScaleMap;
25 class QwtScaleDraw;
26 class QwtTextLabel;
27 class QwtInterval;
28 class QwtText;
29 template< typename T > class QList;
30 
31 // 6.1 compatibility definitions
32 #define QWT_AXIS_COMPAT 1
33 
78 class QWT_EXPORT QwtPlot : public QFrame, public QwtPlotDict
79 {
80  Q_OBJECT
81 
82  Q_PROPERTY( QBrush canvasBackground
83  READ canvasBackground WRITE setCanvasBackground )
84 
85  Q_PROPERTY( bool autoReplot READ autoReplot WRITE setAutoReplot )
86 
87  public:
94  {
97 
100 
103 
105  TopLegend
106  };
107 
108  explicit QwtPlot( QWidget* = NULL );
109  explicit QwtPlot( const QwtText& title, QWidget* = NULL );
110 
111  virtual ~QwtPlot();
112 
113  void setAutoReplot( bool = true );
114  bool autoReplot() const;
115 
116  // Layout
117 
118  void setPlotLayout( QwtPlotLayout* );
119 
120  QwtPlotLayout* plotLayout();
121  const QwtPlotLayout* plotLayout() const;
122 
123  // Title
124 
125  void setTitle( const QString& );
126  void setTitle( const QwtText& );
127  QwtText title() const;
128 
129  QwtTextLabel* titleLabel();
130  const QwtTextLabel* titleLabel() const;
131 
132  // Footer
133 
134  void setFooter( const QString& );
135  void setFooter( const QwtText& );
136  QwtText footer() const;
137 
138  QwtTextLabel* footerLabel();
139  const QwtTextLabel* footerLabel() const;
140 
141  // Canvas
142 
143  void setCanvas( QWidget* );
144 
145  QWidget* canvas();
146  const QWidget* canvas() const;
147 
148  void setCanvasBackground( const QBrush& );
149  QBrush canvasBackground() const;
150 
151  virtual QwtScaleMap canvasMap( QwtAxisId ) const;
152 
153  double invTransform( QwtAxisId, double pos ) const;
154  double transform( QwtAxisId, double value ) const;
155 
156  // Axes
157 
158  bool isAxisValid( QwtAxisId ) const;
159 
160  void setAxisVisible( QwtAxisId, bool on = true );
161  bool isAxisVisible( QwtAxisId ) const;
162 
163  // Axes data
164 
165  QwtScaleEngine* axisScaleEngine( QwtAxisId );
166  const QwtScaleEngine* axisScaleEngine( QwtAxisId ) const;
167  void setAxisScaleEngine( QwtAxisId, QwtScaleEngine* );
168 
169  void setAxisAutoScale( QwtAxisId, bool on = true );
170  bool axisAutoScale( QwtAxisId ) const;
171 
172  void setAxisFont( QwtAxisId, const QFont& );
173  QFont axisFont( QwtAxisId ) const;
174 
175  void setAxisScale( QwtAxisId, double min, double max, double stepSize = 0 );
176  void setAxisScaleDiv( QwtAxisId, const QwtScaleDiv& );
177  void setAxisScaleDraw( QwtAxisId, QwtScaleDraw* );
178 
179  double axisStepSize( QwtAxisId ) const;
180  QwtInterval axisInterval( QwtAxisId ) const;
181  const QwtScaleDiv& axisScaleDiv( QwtAxisId ) const;
182 
183  const QwtScaleDraw* axisScaleDraw( QwtAxisId ) const;
184  QwtScaleDraw* axisScaleDraw( QwtAxisId );
185 
186  const QwtScaleWidget* axisWidget( QwtAxisId ) const;
187  QwtScaleWidget* axisWidget( QwtAxisId );
188 
189  void setAxisLabelAlignment( QwtAxisId, Qt::Alignment );
190  void setAxisLabelRotation( QwtAxisId, double rotation );
191 
192  void setAxisTitle( QwtAxisId, const QString& );
193  void setAxisTitle( QwtAxisId, const QwtText& );
194  QwtText axisTitle( QwtAxisId ) const;
195 
196  void setAxisMaxMinor( QwtAxisId, int maxMinor );
197  int axisMaxMinor( QwtAxisId ) const;
198 
199  void setAxisMaxMajor( QwtAxisId, int maxMajor );
200  int axisMaxMajor( QwtAxisId ) const;
201 
202  // Legend
203 
204  void insertLegend( QwtAbstractLegend*,
205  LegendPosition = QwtPlot::RightLegend, double ratio = -1.0 );
206 
207  QwtAbstractLegend* legend();
208  const QwtAbstractLegend* legend() const;
209 
210  void updateLegend();
211  void updateLegend( const QwtPlotItem* );
212 
213  // Misc
214 
215  virtual QSize sizeHint() const QWT_OVERRIDE;
216  virtual QSize minimumSizeHint() const QWT_OVERRIDE;
217 
218  virtual void updateLayout();
219  virtual void drawCanvas( QPainter* );
220 
221  void updateAxes();
222  void updateCanvasMargins();
223 
224  virtual void getCanvasMarginsHint(
225  const QwtScaleMap maps[], const QRectF& canvasRect,
226  double& left, double& top, double& right, double& bottom) const;
227 
228  virtual bool event( QEvent* ) QWT_OVERRIDE;
229  virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
230 
231  virtual void drawItems( QPainter*, const QRectF&,
232  const QwtScaleMap maps[ QwtAxis::AxisPositions ] ) const;
233 
234  virtual QVariant itemToInfo( QwtPlotItem* ) const;
235  virtual QwtPlotItem* infoToItem( const QVariant& ) const;
236 
237 #if QWT_AXIS_COMPAT
238  enum Axis
239  {
240  yLeft = QwtAxis::YLeft,
241  yRight = QwtAxis::YRight,
242  xBottom = QwtAxis::XBottom,
244 
246  };
247 
248  void enableAxis( int axisId, bool on = true )
249  {
250  setAxisVisible( axisId, on );
251  }
252 
253  bool axisEnabled( int axisId ) const
254  {
255  return isAxisVisible( axisId );
256  }
257 #endif
258 
259  Q_SIGNALS:
266  void itemAttached( QwtPlotItem* plotItem, bool on );
267 
278  void legendDataChanged( const QVariant& itemInfo,
279  const QList< QwtLegendData >& data );
280 
281  public Q_SLOTS:
282  virtual void replot();
283  void autoRefresh();
284 
285  protected:
286 
287  virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
288 
289  private Q_SLOTS:
290  void updateLegendItems( const QVariant& itemInfo,
291  const QList< QwtLegendData >& legendData );
292 
293  private:
294  friend class QwtPlotItem;
295  void attachItem( QwtPlotItem*, bool );
296 
297  void initAxesData();
298  void deleteAxesData();
299  void updateScaleDiv();
300 
301  void initPlot( const QwtText& title );
302 
303  class ScaleData;
305 
306  class PrivateData;
308 };
309 
310 #endif
left
lu_byte left
Definition: lparser.c:1226
QwtScaleDraw
A class for drawing scales.
Definition: qwt_scale_draw.h:35
sol::stack::top
int top(lua_State *L)
Definition: sol.hpp:11684
QwtPlotDict
A dictionary for plot items.
Definition: qwt_plot_dict.h:32
QwtPlot::LegendPosition
LegendPosition
Definition: qwt_plot.h:93
qwt_plot_dict.h
QwtPlot::Axis
Axis
Definition: qwt_plot.h:238
right
lu_byte right
Definition: lparser.c:1227
QwtAbstractLegend
Abstract base class for legend widgets.
Definition: qwt_abstract_legend.h:34
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:78
qwt_global.h
QList
Definition: qwt_abstract_legend.h:17
QwtAxis::YLeft
@ YLeft
Y axis left of the canvas.
Definition: qwt_axis.h:38
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtPlot::m_data
PrivateData * m_data
Definition: qwt_plot.h:306
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtTextLabel
A Widget which displays a QwtText.
Definition: qwt_text_label.h:26
qwt_axis_id.h
QwtPlot::enableAxis
void enableAxis(int axisId, bool on=true)
Definition: qwt_plot.h:248
QwtPlot::m_scaleData
ScaleData * m_scaleData
Definition: qwt_plot.h:303
QwtPlotItem
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:66
QwtPlot::LeftLegend
@ LeftLegend
The legend will be left from the QwtAxis::YLeft axis.
Definition: qwt_plot.h:96
QwtAxisId
int QwtAxisId
Axis identifier.
Definition: qwt_axis_id.h:26
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:26
QwtScaleEngine
Base class for scale engines.
Definition: qwt_scale_engine.h:45
QwtPlotLayout
Layout engine for QwtPlot.
Definition: qwt_plot_layout.h:27
QwtAxis::AxisPositions
@ AxisPositions
Definition: qwt_axis.h:44
QwtPlotItem::updateScaleDiv
virtual void updateScaleDiv(const QwtScaleDiv &, const QwtScaleDiv &)
Update the item to changes of the axes scale division.
Definition: qwt_plot_item.cpp:665
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtPlot::RightLegend
@ RightLegend
The legend will be right from the QwtAxis::YRight axis.
Definition: qwt_plot.h:99
mqtt_test.data
dictionary data
Definition: mqtt_test.py:22
QwtAxis
Definition: qwt_axis.h:18
QwtAxis::XTop
@ XTop
X axis above the canvas.
Definition: qwt_axis.h:47
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:33
QwtPlot::PrivateData
Definition: qwt_plot.cpp:87
QwtPlot::axisEnabled
bool axisEnabled(int axisId) const
Definition: qwt_plot.h:253
QwtPlot::BottomLegend
@ BottomLegend
The legend will be below the footer.
Definition: qwt_plot.h:102
QwtPlotItem::title
const QwtText & title() const
Definition: qwt_plot_item.cpp:215
QwtAxis::YRight
@ YRight
Y axis right of the canvas.
Definition: qwt_axis.h:41
QwtPlot::ScaleData
Definition: qwt_plot_axis.cpp:80
QwtScaleWidget
A Widget which contains a scale.
Definition: qwt_scale_widget.h:34
QwtAxis::XBottom
@ XBottom
X axis below the canvas.
Definition: qwt_axis.h:44


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45