QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_RESCALER_H
28#define QWT_PLOT_RESCALER_H
29
30#include "qwt_global.h"
31#include "qwt_plot.h"
32
33#include <qobject.h>
34
35class QwtPlot;
36class QwtInterval;
37class QResizeEvent;
38
52class QWT_EXPORT QwtPlotRescaler : public QObject
53{
54 Q_OBJECT
55
56 public:
72 {
86
104
115 Fitting
116 };
117
131 {
134
137
139 ExpandBoth
140 };
141
142 // Constructs a rescaler for the given canvas with specified reference axis and policy
143 explicit QwtPlotRescaler( QWidget* canvas,
144 QwtAxisId referenceAxis = QwtAxis::XBottom,
145 RescalePolicy = Expanding );
146
147 // Destructs the rescaler
148 virtual ~QwtPlotRescaler();
149
150 // Enable or disable the rescaler
151 void setEnabled( bool );
152 // Check if the rescaler is enabled
153 bool isEnabled() const;
154
155 // Set the rescale policy
156 void setRescalePolicy( RescalePolicy );
157 // Get the rescale policy
158 RescalePolicy rescalePolicy() const;
159
160 // Set the expanding direction for all axes
161 void setExpandingDirection( ExpandingDirection );
162 // Set the expanding direction for a specific axis
163 void setExpandingDirection( QwtAxisId, ExpandingDirection );
164 // Get the expanding direction for a specific axis
165 ExpandingDirection expandingDirection( QwtAxisId ) const;
166
167 // Set the reference axis
168 void setReferenceAxis( QwtAxisId );
169 // Get the reference axis
170 QwtAxisId referenceAxis() const;
171
172 // Set the aspect ratio for all axes
173 void setAspectRatio( double ratio );
174 // Set the aspect ratio for a specific axis
175 void setAspectRatio( QwtAxisId, double ratio );
176 // Get the aspect ratio for a specific axis
177 double aspectRatio( QwtAxisId ) const;
178
179 // Set the interval hint for a specific axis
180 void setIntervalHint( QwtAxisId, const QwtInterval& );
181 // Get the interval hint for a specific axis
182 QwtInterval intervalHint( QwtAxisId ) const;
183
184 // Get the canvas widget
185 QWidget* canvas();
186 // Get the canvas widget (const version)
187 const QWidget* canvas() const;
188
189 // Get the plot widget
190 QwtPlot* plot();
191 // Get the plot widget (const version)
192 const QwtPlot* plot() const;
193
194 // Event filter for the plot canvas
195 virtual bool eventFilter( QObject*, QEvent* ) override;
196
197 // Rescale the plot axes
198 void rescale() const;
199
200 protected:
201 // Handle canvas resize events
202 virtual void canvasResizeEvent( QResizeEvent* );
203
204 // Rescale the axes with old and new sizes
205 virtual void rescale( const QSize& oldSize, const QSize& newSize ) const;
206 // Expand a scale interval
207 virtual QwtInterval expandScale(
208 QwtAxisId, const QSize& oldSize, const QSize& newSize ) const;
209
210 // Sync a scale to the reference axis
211 virtual QwtInterval syncScale(
212 QwtAxisId, const QwtInterval& reference, const QSize& size ) const;
213
214 // Update the axes scales
215 virtual void updateScales(
216 QwtInterval intervals[QwtAxis::AxisPositions] ) const;
217
218 // Get the orientation of an axis
219 Qt::Orientation orientation( QwtAxisId ) const;
220 // Get the normalized interval of an axis
221 QwtInterval interval( QwtAxisId ) const;
222 // Expand an interval by the specified width
223 QwtInterval expandInterval( const QwtInterval&,
224 double width, ExpandingDirection ) const;
225
226 private:
227 // Calculate the pixel distance for an axis
228 double pixelDist( QwtAxisId, const QSize& ) const;
229
230 class AxisData;
231 class PrivateData;
232 PrivateData* m_data;
233};
234
235#endif
表示区间的类
Definition qwt_interval.h:45
QwtPlotRescaler 负责处理绘图比例尺的固定宽高比
Definition qwt_plot_rescaler.h:53
ExpandingDirection
扩展方向
Definition qwt_plot_rescaler.h:131
@ ExpandUp
The upper limit of the scale is adjusted
Definition qwt_plot_rescaler.h:133
@ ExpandDown
The lower limit of the scale is adjusted
Definition qwt_plot_rescaler.h:136
RescalePolicy
重缩放策略
Definition qwt_plot_rescaler.h:72
@ Fixed
Definition qwt_plot_rescaler.h:85
@ Expanding
Definition qwt_plot_rescaler.h:103
二维绘图部件
Definition qwt_plot.h:138
@ XBottom
X axis below the canvas
Definition qwt_axis.h:61