qwt_scale_engine.cpp
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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 #include "qwt_scale_engine.h"
11 #include "qwt_math.h"
12 #include "qwt_scale_map.h"
13 #include <qalgorithms.h>
14 #include <qmath.h>
15 #include <float.h>
16 #include <limits>
17 
18 #if QT_VERSION < 0x040601
19 #define qFabs(x) ::fabs(x)
20 #define qExp(x) ::exp(x)
21 #endif
22 
23 static inline double qwtLog( double base, double value )
24 {
25  return log( value ) / log( base );
26 }
27 
28 static inline QwtInterval qwtLogInterval( double base, const QwtInterval &interval )
29 {
30  return QwtInterval( qwtLog( base, interval.minValue() ),
31  qwtLog( base, interval.maxValue() ) );
32 }
33 
34 static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval )
35 {
36  return QwtInterval( qPow( base, interval.minValue() ),
37  qPow( base, interval.maxValue() ) );
38 }
39 
40 
41 #if 1
42 
43 // this version often doesn't find the best ticks: f.e for 15: 5, 10
44 static double qwtStepSize( double intervalSize, int maxSteps, uint base )
45 {
46  const double minStep =
47  QwtScaleArithmetic::divideInterval( intervalSize, maxSteps, base );
48 
49  if ( minStep != 0.0 )
50  {
51  // # ticks per interval
52  const int numTicks = qCeil( qAbs( intervalSize / minStep ) ) - 1;
53 
54  // Do the minor steps fit into the interval?
55  if ( qwtFuzzyCompare( ( numTicks + 1 ) * qAbs( minStep ),
56  qAbs( intervalSize ), intervalSize ) > 0 )
57  {
58  // The minor steps doesn't fit into the interval
59  return 0.5 * intervalSize;
60  }
61  }
62 
63  return minStep;
64 }
65 
66 #else
67 
68 static double qwtStepSize( double intervalSize, int maxSteps, uint base )
69 {
70  if ( maxSteps <= 0 )
71  return 0.0;
72 
73  if ( maxSteps > 2 )
74  {
75  for ( int numSteps = maxSteps; numSteps > 1; numSteps-- )
76  {
77  const double stepSize = intervalSize / numSteps;
78 
79  const double p = ::floor( ::log( stepSize ) / ::log( base ) );
80  const double fraction = qPow( base, p );
81 
82  for ( uint n = base; n > 1; n /= 2 )
83  {
84  if ( qFuzzyCompare( stepSize, n * fraction ) )
85  return stepSize;
86 
87  if ( n == 3 && ( base % 2 ) == 0 )
88  {
89  if ( qFuzzyCompare( stepSize, 2 * fraction ) )
90  return stepSize;
91  }
92  }
93  }
94  }
95 
96  return intervalSize * 0.5;
97 }
98 
99 #endif
100 
101 static const double _eps = 1.0e-6;
102 
113 double QwtScaleArithmetic::ceilEps( double value,
114  double intervalSize )
115 {
116  const double eps = _eps * intervalSize;
117 
118  value = ( value - eps ) / intervalSize;
119  return ::ceil( value ) * intervalSize;
120 }
121 
131 double QwtScaleArithmetic::floorEps( double value, double intervalSize )
132 {
133  const double eps = _eps * intervalSize;
134 
135  value = ( value + eps ) / intervalSize;
136  return ::floor( value ) * intervalSize;
137 }
138 
148 double QwtScaleArithmetic::divideEps( double intervalSize, double numSteps )
149 {
150  if ( numSteps == 0.0 || intervalSize == 0.0 )
151  return 0.0;
152 
153  return ( intervalSize - ( _eps * intervalSize ) ) / numSteps;
154 }
155 
166  double intervalSize, int numSteps, uint base )
167 {
168  if ( numSteps <= 0 )
169  return 0.0;
170 
171  const double v = QwtScaleArithmetic::divideEps( intervalSize, numSteps );
172  if ( v == 0.0 )
173  return 0.0;
174 
175  const double lx = qwtLog( base, qFabs( v ) );
176  const double p = ::floor( lx );
177 
178  const double fraction = qPow( base, lx - p );
179 
180  uint n = base;
181  while ( ( n > 1 ) && ( fraction <= n / 2 ) )
182  n /= 2;
183 
184  double stepSize = n * qPow( base, p );
185  if ( v < 0 )
186  stepSize = -stepSize;
187 
188  return stepSize;
189 }
190 
192 {
193 public:
195  attributes( QwtScaleEngine::NoAttribute ),
196  lowerMargin( 0.0 ),
197  upperMargin( 0.0 ),
198  referenceValue( 0.0 ),
199  base( 10 ),
200  transform( NULL )
201  {
202  }
203 
205  {
206  delete transform;
207  }
208 
210 
211  double lowerMargin;
212  double upperMargin;
213 
215 
216  uint base;
217 
219 };
220 
228 {
229  d_data = new PrivateData;
230  setBase( base );
231 }
232 
233 
236 {
237  delete d_data;
238 }
239 
254 {
255  if ( transform != d_data->transform )
256  {
257  delete d_data->transform;
258  d_data->transform = transform;
259  }
260 }
261 
271 {
272  QwtTransform *transform = NULL;
273  if ( d_data->transform )
274  transform = d_data->transform->copy();
275 
276  return transform;
277 }
278 
286 {
287  return d_data->lowerMargin;
288 }
289 
297 {
298  return d_data->upperMargin;
299 }
300 
317 void QwtScaleEngine::setMargins( double lower, double upper )
318 {
319  d_data->lowerMargin = qMax( lower, 0.0 );
320  d_data->upperMargin = qMax( upper, 0.0 );
321 }
322 
332  double intervalSize, int numSteps ) const
333 {
335  intervalSize, numSteps, d_data->base );
336 }
337 
347  const QwtInterval &interval, double value ) const
348 {
349  if ( !interval.isValid() )
350  return false;
351 
352  if ( qwtFuzzyCompare( value, interval.minValue(), interval.width() ) < 0 )
353  return false;
354 
355  if ( qwtFuzzyCompare( value, interval.maxValue(), interval.width() ) > 0 )
356  return false;
357 
358  return true;
359 }
360 
369 QList<double> QwtScaleEngine::strip( const QList<double>& ticks,
370  const QwtInterval &interval ) const
371 {
372  if ( !interval.isValid() || ticks.count() == 0 )
373  return QList<double>();
374 
375  if ( contains( interval, ticks.first() )
376  && contains( interval, ticks.last() ) )
377  {
378  return ticks;
379  }
380 
381  QList<double> strippedTicks;
382  for ( int i = 0; i < ticks.count(); i++ )
383  {
384  if ( contains( interval, ticks[i] ) )
385  strippedTicks += ticks[i];
386  }
387  return strippedTicks;
388 }
389 
401 {
402  const double delta = ( value == 0.0 ) ? 0.5 : qAbs( 0.5 * value );
403 
404  if ( DBL_MAX - delta < value )
405  return QwtInterval( DBL_MAX - delta, DBL_MAX );
406 
407  if ( -DBL_MAX + delta > value )
408  return QwtInterval( -DBL_MAX, -DBL_MAX + delta );
409 
410  return QwtInterval( value - delta, value + delta );
411 }
412 
421 void QwtScaleEngine::setAttribute( Attribute attribute, bool on )
422 {
423  if ( on )
424  d_data->attributes |= attribute;
425  else
426  d_data->attributes &= ~attribute;
427 }
428 
436 {
437  return ( d_data->attributes & attribute );
438 }
439 
447 {
448  d_data->attributes = attributes;
449 }
450 
456 {
457  return d_data->attributes;
458 }
459 
470 {
471  d_data->referenceValue = r;
472 }
473 
479 {
480  return d_data->referenceValue;
481 }
482 
495 void QwtScaleEngine::setBase( uint base )
496 {
497  d_data->base = qMax( base, 2U );
498 }
499 
505 {
506  return d_data->base;
507 }
508 
516  QwtScaleEngine( base )
517 {
518 }
519 
522 {
523 }
524 
535 void QwtLinearScaleEngine::autoScale( int maxNumSteps,
536  double &x1, double &x2, double &stepSize ) const
537 {
538  QwtInterval interval( x1, x2 );
539  interval = interval.normalized();
540 
541  interval.setMinValue( interval.minValue() - lowerMargin() );
542  interval.setMaxValue( interval.maxValue() + upperMargin() );
543 
545  interval = interval.symmetrize( reference() );
546 
548  interval = interval.extend( reference() );
549 
550  if ( interval.width() == 0.0 )
551  interval = buildInterval( interval.minValue() );
552 
554  interval.width(), qMax( maxNumSteps, 1 ), base() );
555 
557  interval = align( interval, stepSize );
558 
559  x1 = interval.minValue();
560  x2 = interval.maxValue();
561 
563  {
564  qSwap( x1, x2 );
565  stepSize = -stepSize;
566  }
567 }
568 
582  int maxMajorSteps, int maxMinorSteps, double stepSize ) const
583 {
584  QwtInterval interval = QwtInterval( x1, x2 ).normalized();
585 
586  if ( interval.widthL() > std::numeric_limits<double>::max() )
587  {
588  qWarning() << "QwtLinearScaleEngine::divideScale: overflow";
589  return QwtScaleDiv();
590  }
591 
592  if ( interval.width() <= 0 )
593  return QwtScaleDiv();
594 
595  stepSize = qAbs( stepSize );
596  if ( stepSize == 0.0 )
597  {
598  if ( maxMajorSteps < 1 )
599  maxMajorSteps = 1;
600 
602  interval.width(), maxMajorSteps, base() );
603  }
604 
605  QwtScaleDiv scaleDiv;
606 
607  if ( stepSize != 0.0 )
608  {
609  QList<double> ticks[QwtScaleDiv::NTickTypes];
610  buildTicks( interval, stepSize, maxMinorSteps, ticks );
611 
612  scaleDiv = QwtScaleDiv( interval, ticks );
613  }
614 
615  if ( x1 > x2 )
616  scaleDiv.invert();
617 
618  return scaleDiv;
619 }
620 
632  const QwtInterval& interval, double stepSize, int maxMinorSteps,
633  QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
634 {
635  const QwtInterval boundingInterval = align( interval, stepSize );
636 
637  ticks[QwtScaleDiv::MajorTick] =
638  buildMajorTicks( boundingInterval, stepSize );
639 
640  if ( maxMinorSteps > 0 )
641  {
642  buildMinorTicks( ticks[QwtScaleDiv::MajorTick], maxMinorSteps, stepSize,
644  }
645 
646  for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
647  {
648  ticks[i] = strip( ticks[i], interval );
649 
650  // ticks very close to 0.0 are
651  // explicitely set to 0.0
652 
653  for ( int j = 0; j < ticks[i].count(); j++ )
654  {
655  if ( qwtFuzzyCompare( ticks[i][j], 0.0, stepSize ) == 0 )
656  ticks[i][j] = 0.0;
657  }
658  }
659 }
660 
670  const QwtInterval &interval, double stepSize ) const
671 {
672  int numTicks = qRound( interval.width() / stepSize ) + 1;
673  if ( numTicks > 10000 )
674  numTicks = 10000;
675 
676  QList<double> ticks;
677 #if QT_VERSION >= 0x040700
678  ticks.reserve( numTicks );
679 #endif
680 
681  ticks += interval.minValue();
682  for ( int i = 1; i < numTicks - 1; i++ )
683  ticks += interval.minValue() + i * stepSize;
684  ticks += interval.maxValue();
685 
686  return ticks;
687 }
688 
700  const QList<double>& majorTicks,
701  int maxMinorSteps, double stepSize,
702  QList<double> &minorTicks,
703  QList<double> &mediumTicks ) const
704 {
705  double minStep = qwtStepSize( stepSize, maxMinorSteps, base() );
706  if ( minStep == 0.0 )
707  return;
708 
709  // # ticks per interval
710  const int numTicks = qCeil( qAbs( stepSize / minStep ) ) - 1;
711 
712  int medIndex = -1;
713  if ( numTicks % 2 )
714  medIndex = numTicks / 2;
715 
716  // calculate minor ticks
717 
718  for ( int i = 0; i < majorTicks.count(); i++ )
719  {
720  double val = majorTicks[i];
721  for ( int k = 0; k < numTicks; k++ )
722  {
723  val += minStep;
724 
725  double alignedValue = val;
726  if ( qwtFuzzyCompare( val, 0.0, stepSize ) == 0 )
727  alignedValue = 0.0;
728 
729  if ( k == medIndex )
730  mediumTicks += alignedValue;
731  else
732  minorTicks += alignedValue;
733  }
734  }
735 }
736 
749  const QwtInterval &interval, double stepSize ) const
750 {
751  double x1 = interval.minValue();
752  double x2 = interval.maxValue();
753 
754  // when there is no rounding beside some effect, when
755  // calculating with doubles, we keep the original value
756 
757  const double eps = 0.000000000001; // since Qt 4.8: qFuzzyIsNull
758  if ( -DBL_MAX + stepSize <= x1 )
759  {
760  const double x = QwtScaleArithmetic::floorEps( x1, stepSize );
761  if ( qAbs(x) <= eps || !qFuzzyCompare( x1, x ) )
762  x1 = x;
763  }
764 
765  if ( DBL_MAX - stepSize >= x2 )
766  {
767  const double x = QwtScaleArithmetic::ceilEps( x2, stepSize );
768  if ( qAbs(x) <= eps || !qFuzzyCompare( x2, x ) )
769  x2 = x;
770  }
771 
772  return QwtInterval( x1, x2 );
773 }
774 
782  QwtScaleEngine( base )
783 {
785 }
786 
789 {
790 }
791 
802 void QwtLogScaleEngine::autoScale( int maxNumSteps,
803  double &x1, double &x2, double &stepSize ) const
804 {
805  if ( x1 > x2 )
806  qSwap( x1, x2 );
807 
808  const double logBase = base();
809 
810  QwtInterval interval( x1 / qPow( logBase, lowerMargin() ),
811  x2 * qPow( logBase, upperMargin() ) );
812 
813  if ( interval.maxValue() / interval.minValue() < logBase )
814  {
815  // scale width is less than one step -> try to build a linear scale
816 
817  QwtLinearScaleEngine linearScaler;
818  linearScaler.setAttributes( attributes() );
819  linearScaler.setReference( reference() );
820  linearScaler.setMargins( lowerMargin(), upperMargin() );
821 
822  linearScaler.autoScale( maxNumSteps, x1, x2, stepSize );
823 
824  QwtInterval linearInterval = QwtInterval( x1, x2 ).normalized();
825  linearInterval = linearInterval.limited( LOG_MIN, LOG_MAX );
826 
827  if ( linearInterval.maxValue() / linearInterval.minValue() < logBase )
828  {
829  stepSize = 0.0;
830  return;
831  }
832  }
833 
834  double logRef = 1.0;
835  if ( reference() > LOG_MIN / 2 )
836  logRef = qMin( reference(), LOG_MAX / 2 );
837 
839  {
840  const double delta = qMax( interval.maxValue() / logRef,
841  logRef / interval.minValue() );
842  interval.setInterval( logRef / delta, logRef * delta );
843  }
844 
846  interval = interval.extend( logRef );
847 
848  interval = interval.limited( LOG_MIN, LOG_MAX );
849 
850  if ( interval.width() == 0.0 )
851  interval = buildInterval( interval.minValue() );
852 
853  stepSize = divideInterval( qwtLogInterval( logBase, interval ).width(),
854  qMax( maxNumSteps, 1 ) );
855  if ( stepSize < 1.0 )
856  stepSize = 1.0;
857 
859  interval = align( interval, stepSize );
860 
861  x1 = interval.minValue();
862  x2 = interval.maxValue();
863 
865  {
866  qSwap( x1, x2 );
867  stepSize = -stepSize;
868  }
869 }
870 
884  int maxMajorSteps, int maxMinorSteps, double stepSize ) const
885 {
886  QwtInterval interval = QwtInterval( x1, x2 ).normalized();
887  interval = interval.limited( LOG_MIN, LOG_MAX );
888 
889  if ( interval.width() <= 0 )
890  return QwtScaleDiv();
891 
892  const double logBase = base();
893 
894  if ( interval.maxValue() / interval.minValue() < logBase )
895  {
896  // scale width is less than one decade -> build linear scale
897 
898  QwtLinearScaleEngine linearScaler;
899  linearScaler.setAttributes( attributes() );
900  linearScaler.setReference( reference() );
901  linearScaler.setMargins( lowerMargin(), upperMargin() );
902 
903  return linearScaler.divideScale( x1, x2,
904  maxMajorSteps, maxMinorSteps, 0.0 );
905  }
906 
907  stepSize = qAbs( stepSize );
908  if ( stepSize == 0.0 )
909  {
910  if ( maxMajorSteps < 1 )
911  maxMajorSteps = 1;
912 
913  stepSize = divideInterval(
914  qwtLogInterval( logBase, interval ).width(), maxMajorSteps );
915  if ( stepSize < 1.0 )
916  stepSize = 1.0; // major step must be >= 1 decade
917  }
918 
919  QwtScaleDiv scaleDiv;
920  if ( stepSize != 0.0 )
921  {
922  QList<double> ticks[QwtScaleDiv::NTickTypes];
923  buildTicks( interval, stepSize, maxMinorSteps, ticks );
924 
925  scaleDiv = QwtScaleDiv( interval, ticks );
926  }
927 
928  if ( x1 > x2 )
929  scaleDiv.invert();
930 
931  return scaleDiv;
932 }
933 
945  const QwtInterval& interval, double stepSize, int maxMinorSteps,
946  QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
947 {
948  const QwtInterval boundingInterval = align( interval, stepSize );
949 
950  ticks[QwtScaleDiv::MajorTick] =
951  buildMajorTicks( boundingInterval, stepSize );
952 
953  if ( maxMinorSteps > 0 )
954  {
955  buildMinorTicks( ticks[QwtScaleDiv::MajorTick], maxMinorSteps, stepSize,
957  }
958 
959  for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
960  ticks[i] = strip( ticks[i], interval );
961 }
962 
972  const QwtInterval &interval, double stepSize ) const
973 {
974  double width = qwtLogInterval( base(), interval ).width();
975 
976  int numTicks = qRound( width / stepSize ) + 1;
977  if ( numTicks > 10000 )
978  numTicks = 10000;
979 
980  const double lxmin = ::log( interval.minValue() );
981  const double lxmax = ::log( interval.maxValue() );
982  const double lstep = ( lxmax - lxmin ) / double( numTicks - 1 );
983 
984  QList<double> ticks;
985 #if QT_VERSION >= 0x040700
986  ticks.reserve( numTicks );
987 #endif
988 
989  ticks += interval.minValue();
990 
991  for ( int i = 1; i < numTicks - 1; i++ )
992  ticks += qExp( lxmin + double( i ) * lstep );
993 
994  ticks += interval.maxValue();
995 
996  return ticks;
997 }
998 
1009  const QList<double> &majorTicks,
1010  int maxMinorSteps, double stepSize,
1011  QList<double> &minorTicks,
1012  QList<double> &mediumTicks ) const
1013 {
1014  const double logBase = base();
1015 
1016  if ( stepSize < 1.1 ) // major step width is one base
1017  {
1018  double minStep = divideInterval( stepSize, maxMinorSteps + 1 );
1019  if ( minStep == 0.0 )
1020  return;
1021 
1022  const int numSteps = qRound( stepSize / minStep );
1023 
1024  int mediumTickIndex = -1;
1025  if ( ( numSteps > 2 ) && ( numSteps % 2 == 0 ) )
1026  mediumTickIndex = numSteps / 2;
1027 
1028  for ( int i = 0; i < majorTicks.count() - 1; i++ )
1029  {
1030  const double v = majorTicks[i];
1031  const double s = logBase / numSteps;
1032 
1033  if ( s >= 1.0 )
1034  {
1035  if ( !qFuzzyCompare( s, 1.0 ) )
1036  minorTicks += v * s;
1037 
1038  for ( int j = 2; j < numSteps; j++ )
1039  {
1040  minorTicks += v * j * s;
1041  }
1042  }
1043  else
1044  {
1045  for ( int j = 1; j < numSteps; j++ )
1046  {
1047  const double tick = v + j * v * ( logBase - 1 ) / numSteps;
1048  if ( j == mediumTickIndex )
1049  mediumTicks += tick;
1050  else
1051  minorTicks += tick;
1052  }
1053  }
1054  }
1055  }
1056  else
1057  {
1058  double minStep = divideInterval( stepSize, maxMinorSteps );
1059  if ( minStep == 0.0 )
1060  return;
1061 
1062  if ( minStep < 1.0 )
1063  minStep = 1.0;
1064 
1065  // # subticks per interval
1066  int numTicks = qRound( stepSize / minStep ) - 1;
1067 
1068  // Do the minor steps fit into the interval?
1069  if ( qwtFuzzyCompare( ( numTicks + 1 ) * minStep,
1070  stepSize, stepSize ) > 0 )
1071  {
1072  numTicks = 0;
1073  }
1074 
1075  if ( numTicks < 1 )
1076  return;
1077 
1078  int mediumTickIndex = -1;
1079  if ( ( numTicks > 2 ) && ( numTicks % 2 ) )
1080  mediumTickIndex = numTicks / 2;
1081 
1082  // substep factor = base^substeps
1083  const qreal minFactor = qMax( qPow( logBase, minStep ), qreal( logBase ) );
1084 
1085  for ( int i = 0; i < majorTicks.count(); i++ )
1086  {
1087  double tick = majorTicks[i];
1088  for ( int j = 0; j < numTicks; j++ )
1089  {
1090  tick *= minFactor;
1091 
1092  if ( j == mediumTickIndex )
1093  mediumTicks += tick;
1094  else
1095  minorTicks += tick;
1096  }
1097  }
1098  }
1099 }
1100 
1113  const QwtInterval &interval, double stepSize ) const
1114 {
1115  const QwtInterval intv = qwtLogInterval( base(), interval );
1116 
1117  double x1 = QwtScaleArithmetic::floorEps( intv.minValue(), stepSize );
1118  if ( qwtFuzzyCompare( interval.minValue(), x1, stepSize ) == 0 )
1119  x1 = interval.minValue();
1120 
1121  double x2 = QwtScaleArithmetic::ceilEps( intv.maxValue(), stepSize );
1122  if ( qwtFuzzyCompare( interval.maxValue(), x2, stepSize ) == 0 )
1123  x2 = interval.maxValue();
1124 
1125  return qwtPowInterval( base(), QwtInterval( x1, x2 ) );
1126 }
int v
static QwtInterval qwtLogInterval(double base, const QwtInterval &interval)
void setTransformation(QwtTransform *)
QwtInterval limited(double minValue, double maxValue) const
QwtInterval normalized() const
Normalize the limits of the interval.
#define qExp(x)
#define LOG_MAX
Maximum value for logarithmic scales.
Definition: qwt_math.h:42
QwtLinearScaleEngine(uint base=10)
int qwtFuzzyCompare(double value1, double value2, double intervalSize)
Compare 2 values, relative to an interval.
Definition: qwt_math.h:63
bool testAttribute(Attribute) const
Logarithmic transformation.
static const double _eps
bool contains(const QwtInterval &, double val) const
A class representing an interval.
Definition: qwt_interval.h:26
double minValue() const
Definition: qwt_interval.h:193
#define LOG_MIN
Minimum value for logarithmic scales.
Definition: qwt_math.h:37
void setMargins(double lower, double upper)
Specify margins at the scale&#39;s endpoints.
void buildTicks(const QwtInterval &, double stepSize, int maxMinSteps, QList< double > ticks[QwtScaleDiv::NTickTypes]) const
Calculate ticks for an interval.
XmlRpcServer s
A class representing a scale division.
Definition: qwt_scale_div.h:36
long double widthL() const
Return the width of an interval as long double.
Definition: qwt_interval.h:242
QwtTransform * transformation() const
static double divideInterval(double interval, int numSteps, uint base)
#define qFabs(x)
double upperMargin() const
double lowerMargin() const
virtual QwtScaleDiv divideScale(double x1, double x2, int numMajorSteps, int numMinorSteps, double stepSize=0.0) const
Calculate a scale division for an interval.
double maxValue() const
Definition: qwt_interval.h:199
virtual ~QwtLogScaleEngine()
Destructor.
QwtScaleEngine(uint base=10)
static double qwtLog(double base, double value)
virtual void autoScale(int maxSteps, double &x1, double &x2, double &stepSize) const
void setReference(double reference)
Specify a reference point.
void buildMinorTicks(const QList< double > &majorTicks, int maxMinorSteps, double stepSize, QList< double > &minorTicks, QList< double > &mediumTicks) const
Calculate minor/medium ticks for major ticks.
double reference() const
void buildTicks(const QwtInterval &, double stepSize, int maxMinSteps, QList< double > ticks[QwtScaleDiv::NTickTypes]) const
Calculate ticks for an interval.
void setInterval(double minValue, double maxValue, BorderFlags=IncludeBorders)
Definition: qwt_interval.h:144
virtual ~QwtLinearScaleEngine()
Destructor.
bool isValid() const
Definition: qwt_interval.h:211
A transformation between coordinate systems.
Definition: qwt_transform.h:35
virtual void autoScale(int maxSteps, double &x1, double &x2, double &stepSize) const
virtual QwtScaleDiv divideScale(double x1, double x2, int numMajorSteps, int numMinorSteps, double stepSize=0.0) const
Calculate a scale division for an interval.
static double divideEps(double interval, double steps)
Divide an interval into steps.
TFSIMD_FORCE_INLINE const tfScalar & x() const
Number of valid tick types.
Definition: qwt_scale_div.h:55
bool log
Build a scale which is symmetric to the reference() value.
static double floorEps(double value, double intervalSize)
virtual ~QwtScaleEngine()
Destructor.
void buildMinorTicks(const QList< double > &majorTicks, int maxMinorSteps, double stepSize, QList< double > &minorTicks, QList< double > &mediumTicks) const
Calculate minor/medium ticks for major ticks.
QFlags< Attribute > Attributes
Layout attributes.
QwtInterval align(const QwtInterval &, double stepSize) const
Align an interval to a step size.
void setMinValue(double)
Definition: qwt_interval.h:177
static double qwtStepSize(double intervalSize, int maxSteps, uint base)
QList< double > strip(const QList< double > &, const QwtInterval &) const
Turn the scale upside down.
static QwtInterval qwtPowInterval(double base, const QwtInterval &interval)
static double ceilEps(double value, double intervalSize)
Attributes attributes() const
double divideInterval(double interval, int numSteps) const
void setBase(uint base)
QList< double > buildMajorTicks(const QwtInterval &interval, double stepSize) const
Calculate major ticks for an interval.
A scale engine for linear scales.
QwtInterval extend(double value) const
Extend the interval.
QwtInterval buildInterval(double v) const
Build an interval around a value.
uint base() const
int i
QwtInterval symmetrize(double value) const
QList< double > buildMajorTicks(const QwtInterval &interval, double stepSize) const
Calculate major ticks for an interval.
double width() const
Return the width of an interval.
Definition: qwt_interval.h:228
Build a scale which includes the reference() value.
QwtScaleEngine::Attributes attributes
void setMaxValue(double)
Definition: qwt_interval.h:187
QwtLogScaleEngine(uint base=10)
void setAttributes(Attributes)
void setAttribute(Attribute, bool on=true)
virtual double transform(double value) const =0
QwtInterval align(const QwtInterval &, double stepSize) const
Align an interval to a step size.
int n
Base class for scale engines.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17