The QwtScaleDiv class can build linear and logarithmic scale divisions for specified intervals. It uses an adjustable algorithm to generate the major and minor step widths automatically. A scale division has a minimum value, a maximum value, a vector of major marks, and a vector of minor marks.
#include "../include/qwt_scldiv.h> #include <iostream.h> main() { int i,k; QwtScaleDiv sd; sd.rebuild(0.01, 100, 10, 10, TRUE, 0.0); k=0; for (i=0;i<sd.majCnt();i++) { while(k < sd.minCnt()) { if (sd.minMark(k) < sd.majMark(i)) { cout << " - " << sd.minMark(i) << "\n"; k++; } else break; } cout << "-- " << sd.majMark(i) << "\n"; } while(k < sd.minCnt()) { cout << " - " << sd.minMark(i) << "\n"; k++; } }
Definition at line 69 of file qwt_scldiv.h.
Public Member Functions | |
QwtScaleDiv () | |
int | operator== (const QwtScaleDiv &s) const |
int | operator!= (const QwtScaleDiv &s) const |
double | lBound () const |
double | hBound () const |
uint | minCnt () const |
uint | majCnt () const |
bool | logScale () const |
double | majMark (int i) const |
double | minMark (int i) const |
double | majStep () const |
void | reset () |
bool | rebuild (double lBound, double hBound, int maxMaj, int maxMin, bool log, double step=0.0, bool ascend=TRUE) |
|
Construct a QwtScaleDiv instance.
Definition at line 42 of file qwt_scldiv.cpp. |
|
Definition at line 86 of file qwt_scldiv.h. Referenced by QwtPlot::canvasMap(), QwtPlot::print(), QwtPlotPicker::scaleRect(), QwtScaleDraw::setScale(), QwtScaleIf::setScaleMaxMajor(), and QwtScaleIf::setScaleMaxMinor(). |
|
Definition at line 81 of file qwt_scldiv.h. Referenced by QwtPlot::canvasMap(), QwtPlot::print(), QwtPlotPicker::scaleRect(), QwtScaleDraw::setScale(), QwtScaleIf::setScaleMaxMajor(), and QwtScaleIf::setScaleMaxMinor(). |
|
Definition at line 102 of file qwt_scldiv.h. Referenced by QwtPlot::canvasMap(), QwtScaleDraw::draw(), QwtScaleDraw::labelPlacement(), QwtScaleDraw::maxLabelHeight(), QwtScaleDraw::maxLabelWidth(), QwtPlot::print(), QwtScaleDraw::setScale(), QwtScaleIf::setScaleMaxMajor(), and QwtScaleIf::setScaleMaxMinor(). |
|
Definition at line 96 of file qwt_scldiv.h. Referenced by QwtScaleDraw::draw(), QwtGrid::draw(), QwtScaleDraw::maxLabelHeight(), QwtScaleDraw::maxLabelWidth(), QwtScaleDraw::minBorderDist(), QwtScaleDraw::minHeight(), QwtScaleDraw::minLabelDist(), QwtScaleDraw::minWidth(), QwtScaleIf::setScale(), and QwtPlot::sizeHint(). |
|
Return major mark at position i.
Definition at line 105 of file qwt_scldiv.h. Referenced by QwtScaleDraw::draw(), QwtGrid::draw(), QwtScaleDraw::maxLabelHeight(), QwtScaleDraw::maxLabelWidth(), QwtScaleDraw::minBorderDist(), and QwtScaleDraw::minLabelDist(). |
|
Definition at line 113 of file qwt_scldiv.h. Referenced by QwtScaleDraw::draw(), QwtScaleDraw::labelPlacement(), QwtScaleDraw::maxLabelHeight(), and QwtScaleDraw::maxLabelWidth(). |
|
Definition at line 91 of file qwt_scldiv.h. Referenced by QwtScaleDraw::draw(), QwtGrid::draw(), QwtScaleDraw::minHeight(), QwtScaleDraw::minWidth(), and QwtScaleIf::setScale(). |
|
Return minor mark at position i.
Definition at line 107 of file qwt_scldiv.h. Referenced by QwtScaleDraw::draw(), and QwtGrid::draw(). |
|
Inequality.
Definition at line 439 of file qwt_scldiv.cpp. |
|
Equality operator.
Definition at line 425 of file qwt_scldiv.cpp. References d_hBound, d_lBound, d_log, d_majMarks, d_majStep, and d_minMarks. |
|
Build a scale width major and minor divisions If no fixed step width is specified or if it is set to 0, the major step width will be calculated automatically according to the the value of maxMajSteps. The maxMajSteps parameter has no effect if a fixed step size is specified. The minor step width is always calculated automatically. If the step width is to be calculated automatically, the algorithm tries to find reasonable values fitting into the scheme {1,2,5}*10^n with an integer number n for linear scales. For logarithmic scales, there are three different cases
Definition at line 86 of file qwt_scldiv.cpp. Referenced by QwtAutoScale::build(), QwtAutoScale::buildLinScale(), QwtAutoScale::buildLogScale(), and QwtScaleDraw::setScale(). |
|
Detach the shared data and set everything to zero.
Definition at line 445 of file qwt_scldiv.cpp. Referenced by QwtAutoScale::reset(). |