QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 成员函数 | Protected 成员函数 | 所有成员列表
QwtDateScaleEngine类 参考

A scale engine for date/time values 更多...

#include <qwt_date_scale_engine.h>

类 QwtDateScaleEngine 继承关系图:
QwtLinearScaleEngine QwtScaleEngine

class  PrivateData
 

Public 成员函数

 QwtDateScaleEngine (Qt::TimeSpec=Qt::LocalTime)
 Constructor with time specification
 
 ~QwtDateScaleEngine () override
 Destructor
 
void setTimeSpec (Qt::TimeSpec)
 Set the time specification used by the engine
 
Qt::TimeSpec timeSpec () const
 Get the time specification used by the engine
 
void setUtcOffset (int seconds)
 Set the offset in seconds from Coordinated Universal Time
 
int utcOffset () const
 Get the offset in seconds from Coordinated Universal Time
 
void setWeek0Type (QwtDate::Week0Type)
 Set how to identify the first week of a year
 
QwtDate::Week0Type week0Type () const
 Get how to identify the first week of a year
 
void setMaxWeeks (int)
 Set upper limit for the number of weeks
 
int maxWeeks () const
 Get upper limit for the number of weeks
 
virtual void autoScale (int maxNumSteps, double &x1, double &x2, double &stepSize) const override
 Align and divide an interval
 
virtual QwtScaleDiv divideScale (double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize=0.0) const override
 Calculate a scale division for a date/time interval
 
virtual QwtDate::IntervalType intervalType (const QDateTime &, const QDateTime &, int maxSteps) const
 Classification of a date/time interval division
 
QDateTime toDateTime (double) const
 Translate a double value into a QDateTime object
 
- Public 成员函数 继承自 QwtLinearScaleEngine
 QwtLinearScaleEngine (uint base=10)
 Constructor
 
 ~QwtLinearScaleEngine () override
 Destructor
 
- Public 成员函数 继承自 QwtScaleEngine
 QwtScaleEngine (uint base=10)
 Constructor
 
void setBase (uint base)
 Set the base
 
uint base () const
 Return base of the scale engine
 
void setAttribute (Attribute, bool on=true)
 Set an attribute
 
bool testAttribute (Attribute) const
 Test if an attribute is enabled
 
void setAttributes (Attributes)
 Set attributes
 
Attributes attributes () const
 Return scale attributes
 
void setReference (double)
 Set the reference value
 
double reference () const
 Return the reference value
 
void setMargins (double lower, double upper)
 Set the margins
 
double lowerMargin () const
 Return the margin at the lower end of the scale
 
double upperMargin () const
 Return the margin at the upper end of the scale
 
void setTransformation (QwtTransform *)
 Set the transformation
 
QwtTransformtransformation () const
 Create and return a clone of the transformation of the engine
 

Protected 成员函数

virtual QDateTime alignDate (const QDateTime &, double stepSize, QwtDate::IntervalType, bool up) const
 Align a date/time value for a step size
 
- Protected 成员函数 继承自 QwtLinearScaleEngine
QwtInterval align (const QwtInterval &, double stepSize) const
 Align an interval to a step size
 
void buildTicks (const QwtInterval &, double stepSize, int maxMinorSteps, QList< double > ticks[QwtScaleDiv::NTickTypes]) const
 Calculate ticks for an interval
 
QList< double > buildMajorTicks (const QwtInterval &interval, double stepSize) const
 Calculate major ticks for an interval
 
void buildMinorTicks (const QList< double > &majorTicks, int maxMinorSteps, double stepSize, QList< double > &minorTicks, QList< double > &mediumTicks) const
 Calculate minor/medium ticks for major ticks
 
- Protected 成员函数 继承自 QwtScaleEngine
bool contains (const QwtInterval &, double value) const
 Check if an interval contains a value
 
QList< double > strip (const QList< double > &, const QwtInterval &) const
 Strip values outside an interval
 
double divideInterval (double intervalSize, int numSteps) const
 Divide an interval
 
QwtInterval buildInterval (double value) const
 Build an interval around a value
 

额外继承的成员函数

- Public 类型 继承自 QwtScaleEngine
enum  Attribute {
  NoAttribute = 0x00 , IncludeReference = 0x01 , Symmetric = 0x02 , Floating = 0x04 ,
  Inverted = 0x08
}
 Layout attributes 更多...
 

详细描述

A scale engine for date/time values

QwtDateScaleEngine builds scales from time intervals. Together with QwtDateScaleDraw it can be used for axes according to date/time values.

Years, months, weeks, days, hours and minutes are organized in steps with non constant intervals. QwtDateScaleEngine classifies intervals and aligns the boundaries and tick positions according to this classification.

QwtDateScaleEngine supports representations depending on Qt::TimeSpec specifications. The valid range for scales is limited by the range of QDateTime, that differs between Qt4 and Qt5.

Datetime values are expected as the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time - also known as "The Epoch", that can be converted to QDateTime using QwtDate::toDateTime().

参见
QwtDate, QwtPlot::setAxisScaleEngine(), QwtAbstractScale::setScaleEngine()

构造及析构函数说明

◆ QwtDateScaleEngine()

QwtDateScaleEngine::QwtDateScaleEngine ( Qt::TimeSpec  timeSpec = Qt::LocalTime)
explicit

Constructor with time specification

Constructor

The engine is initialized to build scales for the given time specification. It classifies intervals > 4 weeks as >= Qt::Month. The first week of a year is defined like for QwtDate::FirstThursday.

参数
[in]timeSpecTime specification
参见
setTimeSpec(), setMaxWeeks(), setWeek0Type()

成员函数说明

◆ alignDate()

QDateTime QwtDateScaleEngine::alignDate ( const QDateTime &  dateTime,
double  stepSize,
QwtDate::IntervalType  intervalType,
bool  up 
) const
protectedvirtual

Align a date/time value for a step size

For Qt::Day alignments there is no "natural day 0" - instead the first day of the year is used to avoid jumping major ticks positions when panning a scale. For other alignments ( f.e according to the first day of the month ) alignDate() has to be overloaded.

参数
dateTimeDate/time value
stepSizeStep size
intervalTypeInterval type
upWhen true dateTime is ceiled - otherwise it is floored
返回
Aligned date/time value

◆ autoScale()

void QwtDateScaleEngine::autoScale ( int  maxNumSteps,
double &  x1,
double &  x2,
double &  stepSize 
) const
overridevirtual

Align and divide an interval

The algorithm aligns and divides the interval into steps. Datetime interval divisions are usually not equidistant and the calculated stepSize can only be used as an approximation for the steps calculated by divideScale().

参数
[in]maxNumStepsMax. number of steps
[out]x1First limit of the interval (In/Out)
[out]x2Second limit of the interval (In/Out)
[out]stepSizeStep size (Out)
参见
QwtScaleEngine::setAttribute()

重载 QwtLinearScaleEngine .

◆ divideScale()

QwtScaleDiv QwtDateScaleEngine::divideScale ( double  x1,
double  x2,
int  maxMajorSteps,
int  maxMinorSteps,
double  stepSize = 0.0 
) const
overridevirtual

Calculate a scale division for a date/time interval

参数
[in]x1First interval limit
[in]x2Second interval limit
[in]maxMajorStepsMaximum for the number of major steps
[in]maxMinorStepsMaximum number of minor steps
[in]stepSizeStep size. If stepSize == 0, the scaleEngine calculates one.
返回
Calculated scale division

重载 QwtLinearScaleEngine .

◆ intervalType()

QwtDate::IntervalType QwtDateScaleEngine::intervalType ( const QDateTime &  minDate,
const QDateTime &  maxDate,
int  maxSteps 
) const
virtual

Classification of a date/time interval division

参数
[in]minDateMinimum ( = earlier ) of the interval
[in]maxDateMaximum ( = later ) of the interval
[in]maxStepsMaximum for the number of steps
返回
Interval classification

◆ maxWeeks()

int QwtDateScaleEngine::maxWeeks ( ) const

Get upper limit for the number of weeks

Get the upper limit for the number of weeks

返回
Upper limit for the number of weeks, when an interval can be classified as Qt::Week
参见
setMaxWeeks(), week0Type()

◆ setMaxWeeks()

void QwtDateScaleEngine::setMaxWeeks ( int  weeks)

Set upper limit for the number of weeks

Set an upper limit for the number of weeks

Set an upper limit for the number of weeks, when an interval can be classified as Qt::Week. The default setting is 4 weeks.

参数
[in]weeksUpper limit for the number of weeks
注解
In business charts a year is often divided into weeks [1-52]
参见
maxWeeks(), setWeek0Type()

◆ setTimeSpec()

void QwtDateScaleEngine::setTimeSpec ( Qt::TimeSpec  timeSpec)

Set the time specification used by the engine

参数
[in]timeSpecTime specification
参见
timeSpec(), setUtcOffset(), toDateTime()

◆ setUtcOffset()

void QwtDateScaleEngine::setUtcOffset ( int  seconds)

Set the offset in seconds from Coordinated Universal Time

参数
[in]secondsOffset in seconds
注解
The offset has no effect beside for the time specification Qt::OffsetFromUTC.
参见
utcOffset(), setTimeSpec(), toDateTime()

◆ setWeek0Type()

void QwtDateScaleEngine::setWeek0Type ( QwtDate::Week0Type  week0Type)

Set how to identify the first week of a year

参数
[in]week0TypeMode how to identify the first week of a year
注解
week0Type has no effect beside for intervals classified as QwtDate::Week.
参见
week0Type(), setMaxWeeks()

◆ timeSpec()

Qt::TimeSpec QwtDateScaleEngine::timeSpec ( ) const

Get the time specification used by the engine

返回
Time specification used by the engine
参见
setTimeSpec(), utcOffset(), toDateTime()

◆ toDateTime()

QDateTime QwtDateScaleEngine::toDateTime ( double  value) const

Translate a double value into a QDateTime object

For QDateTime result is bounded by QwtDate::minDate() and QwtDate::maxDate()

参数
[in]valueDouble value to convert
返回
QDateTime object initialized with timeSpec() and utcOffset()
参见
timeSpec(), utcOffset(), QwtDate::toDateTime()

◆ utcOffset()

int QwtDateScaleEngine::utcOffset ( ) const

Get the offset in seconds from Coordinated Universal Time

返回
Offset in seconds from Coordinated Universal Time
注解
The offset has no effect beside for the time specification Qt::OffsetFromUTC.
参见
setUtcOffset(), setTimeSpec(), toDateTime()

◆ week0Type()

QwtDate::Week0Type QwtDateScaleEngine::week0Type ( ) const

Get how to identify the first week of a year

返回
Setting how to identify the first week of a year
参见
setWeek0Type(), maxWeeks()

该类的文档由以下文件生成: