Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_plot_rescaler.h
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_RESCALER_H
11#define QWT_PLOT_RESCALER_H
12
13#include "qwt_global.h"
14#include "qwt_plot.h"
15
16#include <qobject.h>
17
18class QwtPlot;
19class QwtInterval;
20class QResizeEvent;
21
29class QWT_EXPORT QwtPlotRescaler : public QObject
30{
31 Q_OBJECT
32
33 public:
41 {
48
58
63 Fitting
64 };
65
71 {
74
77
79 ExpandBoth
80 };
81
82 explicit QwtPlotRescaler( QWidget* canvas,
83 QwtAxisId referenceAxis = QwtAxis::XBottom,
84 RescalePolicy = Expanding );
85
86 virtual ~QwtPlotRescaler();
87
88 void setEnabled( bool );
89 bool isEnabled() const;
90
91 void setRescalePolicy( RescalePolicy );
92 RescalePolicy rescalePolicy() const;
93
94 void setExpandingDirection( ExpandingDirection );
95 void setExpandingDirection( QwtAxisId, ExpandingDirection );
96 ExpandingDirection expandingDirection( QwtAxisId ) const;
97
98 void setReferenceAxis( QwtAxisId );
99 QwtAxisId referenceAxis() const;
100
101 void setAspectRatio( double ratio );
102 void setAspectRatio( QwtAxisId, double ratio );
103 double aspectRatio( QwtAxisId ) const;
104
105 void setIntervalHint( QwtAxisId, const QwtInterval& );
106 QwtInterval intervalHint( QwtAxisId ) const;
107
108 QWidget* canvas();
109 const QWidget* canvas() const;
110
111 QwtPlot* plot();
112 const QwtPlot* plot() const;
113
114 virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
115
116 void rescale() const;
117
118 protected:
119 virtual void canvasResizeEvent( QResizeEvent* );
120
121 virtual void rescale( const QSize& oldSize, const QSize& newSize ) const;
122 virtual QwtInterval expandScale(
123 QwtAxisId, const QSize& oldSize, const QSize& newSize ) const;
124
125 virtual QwtInterval syncScale(
126 QwtAxisId, const QwtInterval& reference, const QSize& size ) const;
127
128 virtual void updateScales(
129 QwtInterval intervals[QwtAxis::AxisPositions] ) const;
130
131 Qt::Orientation orientation( QwtAxisId ) const;
132 QwtInterval interval( QwtAxisId ) const;
133 QwtInterval expandInterval( const QwtInterval&,
134 double width, ExpandingDirection ) const;
135
136 private:
137 double pixelDist( QwtAxisId, const QSize& ) const;
138
139 class AxisData;
140 class PrivateData;
141 PrivateData* m_data;
142};
143
144#endif
A class representing an interval.
A 2-D plotting widget.
Definition qwt_plot.h:79
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
@ ExpandUp
The upper limit of the scale is adjusted.
@ ExpandDown
The lower limit of the scale is adjusted.
@ XBottom
X axis below the canvas.
Definition qwt_axis.h:30