#include <qwt_autoscl.h>
Public Types | |
| enum | { None = 0, IncludeRef = 1, Symmetric = 2, Floating = 4, Logarithmic = 8, Inverted = 16 } |
Public Member Functions | |
| QwtAutoScale () | |
| ~QwtAutoScale () | |
| void | setAutoScale () |
| bool | autoScale () const |
| void | setAutoRebuild (bool) |
| bool | autoRebuild () const |
| void | changeOptions (int opt, bool tf) |
| void | setOptions (int opt) |
| bool | option (int opt) const |
| int | options () const |
| void | setMaxMajor (int n) |
| int | maxMajor () const |
| void | setMaxMinor (int n) |
| int | maxMinor () const |
| void | setReference (double r) |
| double | reference () const |
| void | setMargins (double m1, double m2) |
| double | loMargin () const |
| double | hiMargin () const |
| void | setScale (double xmin, double xmax, double step=0.0) |
| const QwtScaleDiv & | scaleDiv () const |
| void | adjust (double *arr, int n, int reset=0) |
| void | adjust (double x1, double x2, int reset=0) |
| void | build () |
| void | reset () |
Protected Member Functions | |
| void | buildLinScale () |
| void | buildLogScale () |
| void | setRange (double x1, double x2) |
Private Attributes | |
| QwtScaleDiv | d_scldiv |
| double | d_minValue |
| double | d_maxValue |
| double | d_scaleMin |
| double | d_scaleMax |
| double | d_step |
| int | d_maxMajor |
| int | d_maxMinor |
| int | d_scaleOpt |
| bool | d_autoScale |
| double | d_loMargin |
| double | d_hiMargin |
| int | d_reset |
| double | d_ref |
| double | d_lref |
| bool | d_autoRebuild |
This class can be used to generate a scale which may span multiple ranges of values. A scale consists of a lower boundary, an upper boundary, a vector of major scale ticks and a vector of minor scale ticks which divide it into subintervals. A quick look at the example below will give you an idea of how the auto-scaler works.
The auto-scaler produces "reasonable" major and minor step sizes. For linear scales, the major step size will fit into the pattern
, where n is an integer. In logarithmic mode (setOptions()) the step size is measured in *decades* and the major step size will be adjusted to fit the pattern
, where n is a natural number including zero.
The step size can be manipulated indirectly using setMaxMajor(). The layout of the scale can be varied with setOptions().
The auto-scaling algorithm can be partly or completely disabled (even temporarily) if a user-defined scale is desired. This can be done with the setScale() function. It can be switched off again with setAutoScale().
The two adjust() members are used to extend the scale if necessary in order to include another range or array of values. The resulting scale division can be obtained with scaleDiv(). reset() resets the scale to zero.
#include <qwt_autoscl.h> #include <iostream.h> double x1[100]; double x2[200]; double range_min, range_max; QwtAutoScale as; // ... determine x1 and x1, range_min and range_max here ... as.reset(); // clear it as.adjust(range_min, range_max); // include a range as.adjust(x1,100); // include an array as.adjust(x2,200); // include another array for (i=0;i<as.scaleDiv().majCnt(); i++) { cout << "Scale tick " << i << " at " << as.scaleDiv().majMark(i) << "\n"; }
Definition at line 78 of file qwt_autoscl.h.
|
|
Definition at line 81 of file qwt_autoscl.h. |
|
|
Ctor.
Definition at line 17 of file qwt_autoscl.cpp. References d_autoRebuild, d_autoScale, d_hiMargin, d_loMargin, d_maxMajor, d_maxMinor, d_maxValue, d_minValue, d_reset, d_scaleMax, d_scaleMin, d_scaleOpt, d_step, and None. |
|
|
Dtor.
Definition at line 37 of file qwt_autoscl.cpp. |
|
||||||||||||||||
|
Adjust the scale to include a specified interval. This member function extends the boundaries of the scale and re-calculates the step size if necessary in order to include a specified interval. If the reset parameter has nonzero value, the previous state will be cleared.
Definition at line 132 of file qwt_autoscl.cpp. References build(), d_autoRebuild, d_maxValue, d_minValue, d_reset, qwtMax, and qwtMin. |
|
||||||||||||||||
|
Adjust the scale to include a given array of input values. This member function extends the boundaries of the scale and re-calculates the step size if necessary in order to include all values in the array. If the reset parameter has nonzero value, the previous state will be cleared.
Definition at line 100 of file qwt_autoscl.cpp. References build(), d_autoRebuild, d_maxValue, d_minValue, and d_reset. Referenced by QwtPlot::initAxes(), and QwtPlot::updateAxes(). |
|
|
Definition at line 706 of file qwt_autoscl.cpp. References d_autoRebuild. |
|
|
Definition at line 45 of file qwt_autoscl.cpp. References d_autoScale. Referenced by QwtPlot::axisAutoScale(), and QwtPlot::updateAxes(). |
|
|
Re-build the scale.
Definition at line 158 of file qwt_autoscl.cpp. References buildLinScale(), buildLogScale(), d_autoScale, d_maxMajor, d_maxMinor, d_reset, d_scaleMax, d_scaleMin, d_scaleOpt, d_scldiv, d_step, Inverted, Logarithmic, and QwtScaleDiv::rebuild(). Referenced by adjust(), changeOptions(), setAutoScale(), setMargins(), setMaxMajor(), setMaxMinor(), setOptions(), setReference(), and setScale(). |
|
|
Build a linear scale.
Definition at line 195 of file qwt_autoscl.cpp. References d_autoScale, d_hiMargin, d_loMargin, d_maxMajor, d_maxMinor, d_maxValue, d_minValue, d_ref, d_scaleMax, d_scaleMin, d_scaleOpt, d_scldiv, Floating, IncludeRef, Inverted, MinEps, qwtAbs, qwtCeil125(), qwtMax, QwtScaleDiv::rebuild(), setRange(), and Symmetric. Referenced by build(). |
|
|
build a logarithmic scale
Definition at line 282 of file qwt_autoscl.cpp. References d_autoScale, d_hiMargin, d_loMargin, d_lref, d_maxMajor, d_maxMinor, d_maxValue, d_minValue, d_scaleMax, d_scaleMin, d_scaleOpt, d_scldiv, Floating, IncludeRef, Inverted, LOG10_2, LOG10_3, LOG10_5, MinEps, qwtAbs, qwtMax, QwtScaleDiv::rebuild(), setRange(), and Symmetric. Referenced by build(). |
|
||||||||||||
|
Set or reset specified scale options.
Definition at line 373 of file qwt_autoscl.cpp. References build(), and d_scaleOpt. Referenced by QwtPlot::changeAxisOptions(). |
|
|
Definition at line 63 of file qwt_autoscl.cpp. References d_hiMargin. |
|
|
Definition at line 54 of file qwt_autoscl.cpp. References d_loMargin. Referenced by QwtPlot::axisMargins(). |
|
|
Definition at line 72 of file qwt_autoscl.cpp. References d_maxMajor. Referenced by QwtPlot::axisMaxMajor(). |
|
|
Definition at line 81 of file qwt_autoscl.cpp. References d_maxMinor. Referenced by QwtPlot::axisMaxMinor(). |
|
|
Returns TRUE if the specified option is set.
Definition at line 664 of file qwt_autoscl.cpp. References d_scaleOpt. |
|
|
Definition at line 674 of file qwt_autoscl.cpp. References d_scaleOpt. Referenced by QwtPlot::axisOptions(). |
|
|
Definition at line 653 of file qwt_autoscl.cpp. References d_ref. Referenced by QwtPlot::axisReference(). |
|
|
Set the interval boundaries to zero and clear the scale division. This member function resets an AutoScale object to its initial state. It is needed to clean up the scale before or after subsequent adjust() calls. The boundaries of the scale are set to zero and the scale division is cleared.
Definition at line 395 of file qwt_autoscl.cpp. References d_maxValue, d_minValue, d_reset, d_scldiv, d_step, and QwtScaleDiv::reset(). Referenced by QwtPlot::updateAxes(). |
|
|
The scale division consists of two boundary values, an array of major tickmarks and an array of minor tickmarks.
Definition at line 687 of file qwt_autoscl.cpp. References d_scldiv. Referenced by QwtPlot::axisScale(), QwtPlot::initAxes(), and QwtPlot::updateAxes(). |
|
|
If true, rebuild scale automatically with call to 'adjust'
Definition at line 697 of file qwt_autoscl.cpp. References d_autoRebuild. |
|
|
Enable auto-scaling. This function is used to switch back to auto-scaling mode if the scale has been frozen temporarily (see setScale()). When auto-scaling is reactivated, the scale will be rebuild, which means that
Definition at line 421 of file qwt_autoscl.cpp. References build(), and d_autoScale. Referenced by QwtPlot::setAxisAutoScale(). |
|
||||||||||||
|
Specify margins at the scale's endpoints.
Definition at line 443 of file qwt_autoscl.cpp. References build(), d_hiMargin, d_loMargin, and qwtMax. Referenced by QwtPlot::setAxisMargins(). |
|
|
Specify the maximum number of major intervals.
Definition at line 459 of file qwt_autoscl.cpp. References build(), d_maxMajor, qwtMax, and qwtMin. Referenced by QwtPlot::setAxisMaxMajor(). |
|
|
Specify the maximum number of minor subdivisions within major scale intervals.
Definition at line 471 of file qwt_autoscl.cpp. References build(), d_maxMinor, qwtMax, and qwtMin. Referenced by QwtPlot::setAxisMaxMinor(). |
|
|
Reset scale options and set specified options.
Definition at line 617 of file qwt_autoscl.cpp. References build(), and d_scaleOpt. Referenced by QwtPlot::setAxisOptions(). |
|
||||||||||||
|
Definition at line 481 of file qwt_autoscl.cpp. References d_scaleMax, d_scaleMin, d_scaleOpt, LOG_MAX, LOG_MIN, Logarithmic, qwtMax, and qwtMin. Referenced by buildLinScale(), buildLogScale(), and setScale(). |
|
|
Specify a reference point.
Definition at line 637 of file qwt_autoscl.cpp. References build(), d_lref, d_ref, LOG_MAX, LOG_MIN, and qwtMin. Referenced by QwtPlot::setAxisReference(). |
|
||||||||||||||||
|
Specify a user-defined scale and switch off auto-scaling.
The fixed-scale mode can switched off using setAutoScale(), which restores the previous values.
Definition at line 544 of file qwt_autoscl.cpp. References build(), d_autoScale, d_step, and setRange(). Referenced by QwtPlot::setAxisScale(). |
|
|
Definition at line 147 of file qwt_autoscl.h. Referenced by adjust(), autoRebuild(), QwtAutoScale(), and setAutoRebuild(). |
|
|
Definition at line 138 of file qwt_autoscl.h. Referenced by autoScale(), build(), buildLinScale(), buildLogScale(), QwtAutoScale(), setAutoScale(), and setScale(). |
|
|
Definition at line 141 of file qwt_autoscl.h. Referenced by buildLinScale(), buildLogScale(), hiMargin(), QwtAutoScale(), and setMargins(). |
|
|
Definition at line 140 of file qwt_autoscl.h. Referenced by buildLinScale(), buildLogScale(), loMargin(), QwtAutoScale(), and setMargins(). |
|
|
Definition at line 145 of file qwt_autoscl.h. Referenced by buildLogScale(), and setReference(). |
|
|
Definition at line 134 of file qwt_autoscl.h. Referenced by build(), buildLinScale(), buildLogScale(), maxMajor(), QwtAutoScale(), and setMaxMajor(). |
|
|
Definition at line 135 of file qwt_autoscl.h. Referenced by build(), buildLinScale(), buildLogScale(), maxMinor(), QwtAutoScale(), and setMaxMinor(). |
|
|
Definition at line 128 of file qwt_autoscl.h. Referenced by adjust(), buildLinScale(), buildLogScale(), QwtAutoScale(), and reset(). |
|
|
Definition at line 127 of file qwt_autoscl.h. Referenced by adjust(), buildLinScale(), buildLogScale(), QwtAutoScale(), and reset(). |
|
|
Definition at line 144 of file qwt_autoscl.h. Referenced by buildLinScale(), reference(), and setReference(). |
|
|
Definition at line 143 of file qwt_autoscl.h. Referenced by adjust(), build(), QwtAutoScale(), and reset(). |
|
|
Definition at line 131 of file qwt_autoscl.h. Referenced by build(), buildLinScale(), buildLogScale(), QwtAutoScale(), and setRange(). |
|
|
Definition at line 130 of file qwt_autoscl.h. Referenced by build(), buildLinScale(), buildLogScale(), QwtAutoScale(), and setRange(). |
|
|
Definition at line 137 of file qwt_autoscl.h. Referenced by build(), buildLinScale(), buildLogScale(), changeOptions(), option(), options(), QwtAutoScale(), setOptions(), and setRange(). |
|
|
Definition at line 125 of file qwt_autoscl.h. Referenced by build(), buildLinScale(), buildLogScale(), reset(), and scaleDiv(). |
|
|
Definition at line 133 of file qwt_autoscl.h. Referenced by build(), QwtAutoScale(), reset(), and setScale(). |
1.3.2