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_interval.h"
13 #include "qwt_transform.h"
14 
15 #include <qdebug.h>
16 
17 #include <limits>
18 
19 static inline double qwtLog( double base, double value )
20 {
21  return std::log( value ) / std::log( base );
22 }
23 
24 static inline QwtInterval qwtLogInterval( double base, const QwtInterval &interval )
25 {
26  return QwtInterval( qwtLog( base, interval.minValue() ),
27  qwtLog( base, interval.maxValue() ) );
28 }
29 
30 static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval )
31 {
32  return QwtInterval( std::pow( base, interval.minValue() ),
33  std::pow( base, interval.maxValue() ) );
34 }
35 
36 #if 1
37 
38 // this version often doesn't find the best ticks: f.e for 15: 5, 10
39 static double qwtStepSize( double intervalSize, int maxSteps, uint base )
40 {
41  const double minStep =
42  QwtScaleArithmetic::divideInterval( intervalSize, maxSteps, base );
43 
44  if ( minStep != 0.0 )
45  {
46  // # ticks per interval
47  const int numTicks = qwtCeil( qAbs( intervalSize / minStep ) ) - 1;
48 
49  // Do the minor steps fit into the interval?
50  if ( qwtFuzzyCompare( ( numTicks + 1 ) * qAbs( minStep ),
51  qAbs( intervalSize ), intervalSize ) > 0 )
52  {
53  // The minor steps doesn't fit into the interval
54  return 0.5 * intervalSize;
55  }
56  }
57 
58  return minStep;
59 }
60 
61 #else
62 
63 static double qwtStepSize( double intervalSize, int maxSteps, uint base )
64 {
65  if ( maxSteps <= 0 )
66  return 0.0;
67 
68  if ( maxSteps > 2 )
69  {
70  for ( int numSteps = maxSteps; numSteps > 1; numSteps-- )
71  {
72  const double stepSize = intervalSize / numSteps;
73 
74  const double p = std::floor( std::log( stepSize ) / std::log( base ) );
75  const double fraction = std::pow( base, p );
76 
77  for ( uint n = base; n > 1; n /= 2 )
78  {
79  if ( qFuzzyCompare( stepSize, n * fraction ) )
80  return stepSize;
81 
82  if ( n == 3 && ( base % 2 ) == 0 )
83  {
84  if ( qFuzzyCompare( stepSize, 2 * fraction ) )
85  return stepSize;
86  }
87  }
88  }
89  }
90 
91  return intervalSize * 0.5;
92 }
93 
94 #endif
95 
96 static const double _eps = 1.0e-6;
97 
109  double intervalSize )
110 {
111  const double eps = _eps * intervalSize;
112 
113  value = ( value - eps ) / intervalSize;
114  return std::ceil( value ) * intervalSize;
115 }
116 
126 double QwtScaleArithmetic::floorEps( double value, double intervalSize )
127 {
128  const double eps = _eps * intervalSize;
129 
130  value = ( value + eps ) / intervalSize;
131  return std::floor( value ) * intervalSize;
132 }
133 
143 double QwtScaleArithmetic::divideEps( double intervalSize, double numSteps )
144 {
145  if ( numSteps == 0.0 || intervalSize == 0.0 )
146  return 0.0;
147 
148  return ( intervalSize - ( _eps * intervalSize ) ) / numSteps;
149 }
150 
161  double intervalSize, int numSteps, uint base )
162 {
163  if ( numSteps <= 0 )
164  return 0.0;
165 
166  const double v = QwtScaleArithmetic::divideEps( intervalSize, numSteps );
167  if ( v == 0.0 )
168  return 0.0;
169 
170  const double lx = qwtLog( base, std::fabs( v ) );
171  const double p = std::floor( lx );
172 
173  const double fraction = std::pow( base, lx - p );
174 
175  uint n = base;
176  while ( ( n > 1 ) && ( fraction <= n / 2 ) )
177  n /= 2;
178 
179  double stepSize = n * std::pow( base, p );
180  if ( v < 0 )
181  stepSize = -stepSize;
182 
183  return stepSize;
184 }
185 
187 {
188 public:
190  attributes( QwtScaleEngine::NoAttribute ),
191  lowerMargin( 0.0 ),
192  upperMargin( 0.0 ),
193  referenceValue( 0.0 ),
194  base( 10 ),
195  transform( NULL )
196  {
197  }
198 
200  {
201  delete transform;
202  }
203 
205 
206  double lowerMargin;
207  double upperMargin;
208 
210 
211  uint base;
212 
214 };
215 
223 {
224  d_data = new PrivateData;
225  setBase( base );
226 }
227 
228 
231 {
232  delete d_data;
233 }
234 
249 {
250  if ( transform != d_data->transform )
251  {
252  delete d_data->transform;
253  d_data->transform = transform;
254  }
255 }
256 
266 {
267  QwtTransform *transform = NULL;
268  if ( d_data->transform )
269  transform = d_data->transform->copy();
270 
271  return transform;
272 }
273 
281 {
282  return d_data->lowerMargin;
283 }
284 
292 {
293  return d_data->upperMargin;
294 }
295 
312 void QwtScaleEngine::setMargins( double lower, double upper )
313 {
314  d_data->lowerMargin = qwtMaxF( lower, 0.0 );
315  d_data->upperMargin = qwtMaxF( upper, 0.0 );
316 }
317 
327  double intervalSize, int numSteps ) const
328 {
330  intervalSize, numSteps, d_data->base );
331 }
332 
342  const QwtInterval &interval, double value ) const
343 {
344  if ( !interval.isValid() )
345  return false;
346 
347  if ( qwtFuzzyCompare( value, interval.minValue(), interval.width() ) < 0 )
348  return false;
349 
350  if ( qwtFuzzyCompare( value, interval.maxValue(), interval.width() ) > 0 )
351  return false;
352 
353  return true;
354 }
355 
365  const QwtInterval &interval ) const
366 {
367  if ( !interval.isValid() || ticks.count() == 0 )
368  return QList<double>();
369 
370  if ( contains( interval, ticks.first() )
371  && contains( interval, ticks.last() ) )
372  {
373  return ticks;
374  }
375 
376  QList<double> strippedTicks;
377  for ( int i = 0; i < ticks.count(); i++ )
378  {
379  if ( contains( interval, ticks[i] ) )
380  strippedTicks += ticks[i];
381  }
382  return strippedTicks;
383 }
384 
396 {
397  const double delta = ( value == 0.0 ) ? 0.5 : qAbs( 0.5 * value );
398  const double max = std::numeric_limits<double>::max();
399 
400  if ( max - delta < value )
401  return QwtInterval( max - delta, max );
402 
403  if ( -max + delta > value )
404  return QwtInterval( -max, -max + delta );
405 
406  return QwtInterval( value - delta, value + delta );
407 }
408 
417 void QwtScaleEngine::setAttribute( Attribute attribute, bool on )
418 {
419  if ( on )
420  d_data->attributes |= attribute;
421  else
422  d_data->attributes &= ~attribute;
423 }
424 
432 {
433  return ( d_data->attributes & attribute );
434 }
435 
443 {
444  d_data->attributes = attributes;
445 }
446 
452 {
453  return d_data->attributes;
454 }
455 
466 {
467  d_data->referenceValue = reference;
468 }
469 
475 {
476  return d_data->referenceValue;
477 }
478 
491 void QwtScaleEngine::setBase( uint base )
492 {
493  d_data->base = qMax( base, 2U );
494 }
495 
501 {
502  return d_data->base;
503 }
504 
512  QwtScaleEngine( base )
513 {
514 }
515 
518 {
519 }
520 
531 void QwtLinearScaleEngine::autoScale( int maxNumSteps,
532  double &x1, double &x2, double &stepSize ) const
533 {
534  QwtInterval interval( x1, x2 );
535  interval = interval.normalized();
536 
537  interval.setMinValue( interval.minValue() - lowerMargin() );
538  interval.setMaxValue( interval.maxValue() + upperMargin() );
539 
541  interval = interval.symmetrize( reference() );
542 
544  interval = interval.extend( reference() );
545 
546  if ( interval.width() == 0.0 )
547  interval = buildInterval( interval.minValue() );
548 
550  interval.width(), qMax( maxNumSteps, 1 ), base() );
551 
553  interval = align( interval, stepSize );
554 
555  x1 = interval.minValue();
556  x2 = interval.maxValue();
557 
559  {
560  qSwap( x1, x2 );
561  stepSize = -stepSize;
562  }
563 }
564 
578  int maxMajorSteps, int maxMinorSteps, double stepSize ) const
579 {
580  QwtInterval interval = QwtInterval( x1, x2 ).normalized();
581 
582  if ( interval.widthL() > std::numeric_limits<double>::max() )
583  {
584  qWarning() << "QwtLinearScaleEngine::divideScale: overflow";
585  return QwtScaleDiv();
586  }
587 
588  if ( interval.width() <= 0 )
589  return QwtScaleDiv();
590 
591  stepSize = qAbs( stepSize );
592  if ( stepSize == 0.0 )
593  {
594  if ( maxMajorSteps < 1 )
595  maxMajorSteps = 1;
596 
598  interval.width(), maxMajorSteps, base() );
599  }
600 
601  QwtScaleDiv scaleDiv;
602 
603  if ( stepSize != 0.0 )
604  {
606  buildTicks( interval, stepSize, maxMinorSteps, ticks );
607 
608  scaleDiv = QwtScaleDiv( interval, ticks );
609  }
610 
611  if ( x1 > x2 )
612  scaleDiv.invert();
613 
614  return scaleDiv;
615 }
616 
628  const QwtInterval& interval, double stepSize, int maxMinorSteps,
630 {
631  const QwtInterval boundingInterval = align( interval, stepSize );
632 
633  ticks[QwtScaleDiv::MajorTick] =
634  buildMajorTicks( boundingInterval, stepSize );
635 
636  if ( maxMinorSteps > 0 )
637  {
638  buildMinorTicks( ticks[QwtScaleDiv::MajorTick], maxMinorSteps, stepSize,
640  }
641 
642  for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
643  {
644  ticks[i] = strip( ticks[i], interval );
645 
646  // ticks very close to 0.0 are
647  // explicitely set to 0.0
648 
649  for ( int j = 0; j < ticks[i].count(); j++ )
650  {
651  if ( qwtFuzzyCompare( ticks[i][j], 0.0, stepSize ) == 0 )
652  ticks[i][j] = 0.0;
653  }
654  }
655 }
656 
666  const QwtInterval &interval, double stepSize ) const
667 {
668  int numTicks = qRound( interval.width() / stepSize ) + 1;
669  if ( numTicks > 10000 )
670  numTicks = 10000;
671 
672  QList<double> ticks;
673  ticks.reserve( numTicks );
674 
675  ticks += interval.minValue();
676  for ( int i = 1; i < numTicks - 1; i++ )
677  ticks += interval.minValue() + i * stepSize;
678  ticks += interval.maxValue();
679 
680  return ticks;
681 }
682 
694  const QList<double>& majorTicks,
695  int maxMinorSteps, double stepSize,
696  QList<double> &minorTicks,
697  QList<double> &mediumTicks ) const
698 {
699  double minStep = qwtStepSize( stepSize, maxMinorSteps, base() );
700  if ( minStep == 0.0 )
701  return;
702 
703  // # ticks per interval
704  const int numTicks = qwtCeil( qAbs( stepSize / minStep ) ) - 1;
705 
706  int medIndex = -1;
707  if ( numTicks % 2 )
708  medIndex = numTicks / 2;
709 
710  // calculate minor ticks
711 
712  for ( int i = 0; i < majorTicks.count(); i++ )
713  {
714  double val = majorTicks[i];
715  for ( int k = 0; k < numTicks; k++ )
716  {
717  val += minStep;
718 
719  double alignedValue = val;
720  if ( qwtFuzzyCompare( val, 0.0, stepSize ) == 0 )
721  alignedValue = 0.0;
722 
723  if ( k == medIndex )
724  mediumTicks += alignedValue;
725  else
726  minorTicks += alignedValue;
727  }
728  }
729 }
730 
743  const QwtInterval &interval, double stepSize ) const
744 {
745  double x1 = interval.minValue();
746  double x2 = interval.maxValue();
747 
748  // when there is no rounding beside some effect, when
749  // calculating with doubles, we keep the original value
750 
751  const double eps = 0.000000000001; // since Qt 4.8: qFuzzyIsNull
752  const double max = std::numeric_limits<double>::max();
753 
754  if ( -max + stepSize <= x1 )
755  {
756  const double x = QwtScaleArithmetic::floorEps( x1, stepSize );
757  if ( qAbs(x) <= eps || !qFuzzyCompare( x1, x ) )
758  x1 = x;
759  }
760 
761  if ( max - stepSize >= x2 )
762  {
763  const double x = QwtScaleArithmetic::ceilEps( x2, stepSize );
764  if ( qAbs(x) <= eps || !qFuzzyCompare( x2, x ) )
765  x2 = x;
766  }
767 
768  return QwtInterval( x1, x2 );
769 }
770 
778  QwtScaleEngine( base )
779 {
781 }
782 
785 {
786 }
787 
798 void QwtLogScaleEngine::autoScale( int maxNumSteps,
799  double &x1, double &x2, double &stepSize ) const
800 {
801  if ( x1 > x2 )
802  qSwap( x1, x2 );
803 
804  const double logBase = base();
805 
806  QwtInterval interval( x1 / std::pow( logBase, lowerMargin() ),
807  x2 * std::pow( logBase, upperMargin() ) );
808 
809  if ( interval.maxValue() / interval.minValue() < logBase )
810  {
811  // scale width is less than one step -> try to build a linear scale
812 
813  QwtLinearScaleEngine linearScaler;
814  linearScaler.setAttributes( attributes() );
815  linearScaler.setReference( reference() );
816  linearScaler.setMargins( lowerMargin(), upperMargin() );
817 
818  linearScaler.autoScale( maxNumSteps, x1, x2, stepSize );
819 
820  QwtInterval linearInterval = QwtInterval( x1, x2 ).normalized();
821  linearInterval = linearInterval.limited(
823 
824  if ( linearInterval.maxValue() / linearInterval.minValue() < logBase )
825  {
826  stepSize = 0.0;
827  return;
828  }
829  }
830 
831  double logRef = 1.0;
832  if ( reference() > QwtLogTransform::LogMin / 2 )
833  logRef = qwtMinF( reference(), QwtLogTransform::LogMax / 2 );
834 
836  {
837  const double delta = qwtMaxF( interval.maxValue() / logRef,
838  logRef / interval.minValue() );
839  interval.setInterval( logRef / delta, logRef * delta );
840  }
841 
843  interval = interval.extend( logRef );
844 
846 
847  if ( interval.width() == 0.0 )
848  interval = buildInterval( interval.minValue() );
849 
850  stepSize = divideInterval( qwtLogInterval( logBase, interval ).width(),
851  qMax( maxNumSteps, 1 ) );
852  if ( stepSize < 1.0 )
853  stepSize = 1.0;
854 
856  interval = align( interval, stepSize );
857 
858  x1 = interval.minValue();
859  x2 = interval.maxValue();
860 
862  {
863  qSwap( x1, x2 );
864  stepSize = -stepSize;
865  }
866 }
867 
881  int maxMajorSteps, int maxMinorSteps, double stepSize ) const
882 {
883  QwtInterval interval = QwtInterval( x1, x2 ).normalized();
885 
886  if ( interval.width() <= 0 )
887  return QwtScaleDiv();
888 
889  const double logBase = base();
890 
891  if ( interval.maxValue() / interval.minValue() < logBase )
892  {
893  // scale width is less than one decade -> build linear scale
894 
895  QwtLinearScaleEngine linearScaler;
896  linearScaler.setAttributes( attributes() );
897  linearScaler.setReference( reference() );
898  linearScaler.setMargins( lowerMargin(), upperMargin() );
899 
900  return linearScaler.divideScale( x1, x2,
901  maxMajorSteps, maxMinorSteps, 0.0 );
902  }
903 
904  stepSize = qAbs( stepSize );
905  if ( stepSize == 0.0 )
906  {
907  if ( maxMajorSteps < 1 )
908  maxMajorSteps = 1;
909 
910  stepSize = divideInterval(
911  qwtLogInterval( logBase, interval ).width(), maxMajorSteps );
912  if ( stepSize < 1.0 )
913  stepSize = 1.0; // major step must be >= 1 decade
914  }
915 
916  QwtScaleDiv scaleDiv;
917  if ( stepSize != 0.0 )
918  {
920  buildTicks( interval, stepSize, maxMinorSteps, ticks );
921 
922  scaleDiv = QwtScaleDiv( interval, ticks );
923  }
924 
925  if ( x1 > x2 )
926  scaleDiv.invert();
927 
928  return scaleDiv;
929 }
930 
942  const QwtInterval& interval, double stepSize, int maxMinorSteps,
944 {
945  const QwtInterval boundingInterval = align( interval, stepSize );
946 
947  ticks[QwtScaleDiv::MajorTick] =
948  buildMajorTicks( boundingInterval, stepSize );
949 
950  if ( maxMinorSteps > 0 )
951  {
952  buildMinorTicks( ticks[QwtScaleDiv::MajorTick], maxMinorSteps, stepSize,
954  }
955 
956  for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ )
957  ticks[i] = strip( ticks[i], interval );
958 }
959 
969  const QwtInterval &interval, double stepSize ) const
970 {
971  double width = qwtLogInterval( base(), interval ).width();
972 
973  int numTicks = qRound( width / stepSize ) + 1;
974  if ( numTicks > 10000 )
975  numTicks = 10000;
976 
977  const double lxmin = std::log( interval.minValue() );
978  const double lxmax = std::log( interval.maxValue() );
979  const double lstep = ( lxmax - lxmin ) / double( numTicks - 1 );
980 
981  QList<double> ticks;
982  ticks.reserve( numTicks );
983 
984  ticks += interval.minValue();
985 
986  for ( int i = 1; i < numTicks - 1; i++ )
987  ticks += std::exp( lxmin + double( i ) * lstep );
988 
989  ticks += interval.maxValue();
990 
991  return ticks;
992 }
993 
1004  const QList<double> &majorTicks,
1005  int maxMinorSteps, double stepSize,
1006  QList<double> &minorTicks,
1007  QList<double> &mediumTicks ) const
1008 {
1009  const double logBase = base();
1010 
1011  if ( stepSize < 1.1 ) // major step width is one base
1012  {
1013  double minStep = divideInterval( stepSize, maxMinorSteps + 1 );
1014  if ( minStep == 0.0 )
1015  return;
1016 
1017  const int numSteps = qRound( stepSize / minStep );
1018 
1019  int mediumTickIndex = -1;
1020  if ( ( numSteps > 2 ) && ( numSteps % 2 == 0 ) )
1021  mediumTickIndex = numSteps / 2;
1022 
1023  for ( int i = 0; i < majorTicks.count() - 1; i++ )
1024  {
1025  const double v = majorTicks[i];
1026  const double s = logBase / numSteps;
1027 
1028  if ( s >= 1.0 )
1029  {
1030  if ( !qFuzzyCompare( s, 1.0 ) )
1031  minorTicks += v * s;
1032 
1033  for ( int j = 2; j < numSteps; j++ )
1034  {
1035  minorTicks += v * j * s;
1036  }
1037  }
1038  else
1039  {
1040  for ( int j = 1; j < numSteps; j++ )
1041  {
1042  const double tick = v + j * v * ( logBase - 1 ) / numSteps;
1043  if ( j == mediumTickIndex )
1044  mediumTicks += tick;
1045  else
1046  minorTicks += tick;
1047  }
1048  }
1049  }
1050  }
1051  else
1052  {
1053  double minStep = divideInterval( stepSize, maxMinorSteps );
1054  if ( minStep == 0.0 )
1055  return;
1056 
1057  if ( minStep < 1.0 )
1058  minStep = 1.0;
1059 
1060  // # subticks per interval
1061  int numTicks = qRound( stepSize / minStep ) - 1;
1062 
1063  // Do the minor steps fit into the interval?
1064  if ( qwtFuzzyCompare( ( numTicks + 1 ) * minStep,
1065  stepSize, stepSize ) > 0 )
1066  {
1067  numTicks = 0;
1068  }
1069 
1070  if ( numTicks < 1 )
1071  return;
1072 
1073  int mediumTickIndex = -1;
1074  if ( ( numTicks > 2 ) && ( numTicks % 2 ) )
1075  mediumTickIndex = numTicks / 2;
1076 
1077  // substep factor = base^substeps
1078  const qreal minFactor = qwtMaxF( std::pow( logBase, minStep ), logBase );
1079 
1080  for ( int i = 0; i < majorTicks.count(); i++ )
1081  {
1082  double tick = majorTicks[i];
1083  for ( int j = 0; j < numTicks; j++ )
1084  {
1085  tick *= minFactor;
1086 
1087  if ( j == mediumTickIndex )
1088  mediumTicks += tick;
1089  else
1090  minorTicks += tick;
1091  }
1092  }
1093  }
1094 }
1095 
1108  const QwtInterval &interval, double stepSize ) const
1109 {
1110  const QwtInterval intv = qwtLogInterval( base(), interval );
1111 
1112  double x1 = QwtScaleArithmetic::floorEps( intv.minValue(), stepSize );
1113  if ( qwtFuzzyCompare( interval.minValue(), x1, stepSize ) == 0 )
1114  x1 = interval.minValue();
1115 
1116  double x2 = QwtScaleArithmetic::ceilEps( intv.maxValue(), stepSize );
1117  if ( qwtFuzzyCompare( interval.maxValue(), x2, stepSize ) == 0 )
1118  x2 = interval.maxValue();
1119 
1120  return qwtPowInterval( base(), QwtInterval( x1, x2 ) );
1121 }
static QwtInterval qwtLogInterval(double base, const QwtInterval &interval)
void setTransformation(QwtTransform *)
enum MQTTPropertyCodes value
QwtInterval normalized() const
Normalize the limits of the interval.
QwtLinearScaleEngine(uint base=10)
int qwtFuzzyCompare(double value1, double value2, double intervalSize)
Compare 2 values, relative to an interval.
Definition: qwt_math.h:166
bool testAttribute(Attribute) const
Logarithmic transformation.
static const double _eps
A class representing an interval.
Definition: qwt_interval.h:22
QWT_CONSTEXPR float qwtMaxF(float a, float b)
Definition: qwt_math.h:123
double minValue() const
Definition: qwt_interval.h:190
void setMargins(double lower, double upper)
Specify margins at the scale&#39;s endpoints.
static double divideEps(double intervalSize, double numSteps)
Divide an interval into steps.
virtual QwtScaleDiv divideScale(double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize=0.0) const QWT_OVERRIDE
Calculate a scale division for an interval.
virtual void autoScale(int maxNumSteps, double &x1, double &x2, double &stepSize) const QWT_OVERRIDE
QwtInterval buildInterval(double value) const
Build an interval around a value.
A class representing a scale division.
Definition: qwt_scale_div.h:33
long double widthL() const
Return the width of an interval as long double.
Definition: qwt_interval.h:239
QwtTransform * transformation() const
double upperMargin() const
double lowerMargin() const
QWT_CONSTEXPR float qwtMinF(float a, float b)
Definition: qwt_math.h:99
double maxValue() const
Definition: qwt_interval.h:196
static double divideInterval(double intervalSize, int numSteps, uint base)
virtual ~QwtLogScaleEngine()
Destructor.
QwtScaleEngine(uint base=10)
static double qwtLog(double base, double value)
QwtInterval limited(double lowerBound, double upperBound) const
void buildMinorTicks(const QList< double > &majorTicks, int maxMinorSteps, double stepSize, QList< double > &minorTicks, QList< double > &mediumTicks) const
Calculate minor/medium ticks for major ticks.
#define max(A, B)
Definition: Socket.h:88
double reference() const
void setInterval(double minValue, double maxValue, BorderFlags=IncludeBorders)
Definition: qwt_interval.h:141
virtual ~QwtLinearScaleEngine()
Destructor.
bool isValid() const
Definition: qwt_interval.h:208
A transformation between coordinate systems.
Definition: qwt_transform.h:35
static const double LogMax
Largest allowed value for logarithmic scales: 1.0e150.
basic_reference< false > reference
Definition: forward.hpp:610
char upper
Definition: utf-8.c:50
static const double LogMin
Smallest allowed value for logarithmic scales: 1.0e-150.
bool contains(const QwtInterval &, double value) const
virtual void autoScale(int maxNumSteps, double &x1, double &x2, double &stepSize) const QWT_OVERRIDE
Number of valid tick types.
Definition: qwt_scale_div.h:52
Build a scale which is symmetric to the reference() value.
static double floorEps(double value, double intervalSize)
void buildTicks(const QwtInterval &, double stepSize, int maxMinorSteps, QList< double > ticks[QwtScaleDiv::NTickTypes]) const
Calculate ticks for an interval.
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:174
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)
void setReference(double)
Specify a reference point.
static double ceilEps(double value, double intervalSize)
Attributes attributes() 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.
void buildTicks(const QwtInterval &, double stepSize, int maxMinorSteps, QList< double > ticks[QwtScaleDiv::NTickTypes]) const
Calculate ticks for an interval.
char lower
Definition: utf-8.c:49
uint base() const
double divideInterval(double intervalSize, int numSteps) const
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:225
Build a scale which includes the reference() value.
QwtScaleEngine::Attributes attributes
void setMaxValue(double)
Definition: qwt_interval.h:184
QwtLogScaleEngine(uint base=10)
void setAttributes(Attributes)
void setAttribute(Attribute, bool on=true)
int qwtCeil(qreal value)
Definition: qwt_math.h:262
virtual double transform(double value) const =0
QwtInterval align(const QwtInterval &, double stepSize) const
Align an interval to a step size.
virtual QwtScaleDiv divideScale(double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize=0.0) const QWT_OVERRIDE
Calculate a scale division for an interval.
Base class for scale engines.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10