QwtDateScaleEngine.3 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. .TH "QwtDateScaleEngine" 3 "Mon Dec 28 2020" "Version 6.1.6" "Qwt User's Guide" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. QwtDateScaleEngine \- A scale engine for date/time values\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <qwt_date_scale_engine\&.h>\fP
  11. .PP
  12. Inherits \fBQwtLinearScaleEngine\fP\&.
  13. .SS "Public Member Functions"
  14. .in +1c
  15. .ti -1c
  16. .RI "\fBQwtDateScaleEngine\fP (Qt::TimeSpec=Qt::LocalTime)"
  17. .br
  18. .RI "Constructor\&. "
  19. .ti -1c
  20. .RI "virtual \fB~QwtDateScaleEngine\fP ()"
  21. .br
  22. .RI "Destructor\&. "
  23. .ti -1c
  24. .RI "void \fBsetTimeSpec\fP (Qt::TimeSpec)"
  25. .br
  26. .ti -1c
  27. .RI "Qt::TimeSpec \fBtimeSpec\fP () const"
  28. .br
  29. .ti -1c
  30. .RI "void \fBsetUtcOffset\fP (int seconds)"
  31. .br
  32. .ti -1c
  33. .RI "int \fButcOffset\fP () const"
  34. .br
  35. .ti -1c
  36. .RI "void \fBsetWeek0Type\fP (\fBQwtDate::Week0Type\fP)"
  37. .br
  38. .ti -1c
  39. .RI "\fBQwtDate::Week0Type\fP \fBweek0Type\fP () const"
  40. .br
  41. .ti -1c
  42. .RI "void \fBsetMaxWeeks\fP (int)"
  43. .br
  44. .ti -1c
  45. .RI "int \fBmaxWeeks\fP () const"
  46. .br
  47. .ti -1c
  48. .RI "virtual void \fBautoScale\fP (int maxNumSteps, double &x1, double &x2, double &stepSize) const"
  49. .br
  50. .ti -1c
  51. .RI "virtual \fBQwtScaleDiv\fP \fBdivideScale\fP (double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize=0\&.0) const"
  52. .br
  53. .RI "Calculate a scale division for a date/time interval\&. "
  54. .ti -1c
  55. .RI "virtual \fBQwtDate::IntervalType\fP \fBintervalType\fP (const QDateTime &, const QDateTime &, int maxSteps) const"
  56. .br
  57. .ti -1c
  58. .RI "QDateTime \fBtoDateTime\fP (double) const"
  59. .br
  60. .in -1c
  61. .SS "Protected Member Functions"
  62. .in +1c
  63. .ti -1c
  64. .RI "virtual QDateTime \fBalignDate\fP (const QDateTime &, double stepSize, \fBQwtDate::IntervalType\fP, bool up) const"
  65. .br
  66. .in -1c
  67. .SS "Additional Inherited Members"
  68. .SH "Detailed Description"
  69. .PP
  70. A scale engine for date/time values\&.
  71. \fBQwtDateScaleEngine\fP builds scales from a time intervals\&. Together with \fBQwtDateScaleDraw\fP it can be used for axes according to date/time values\&.
  72. .PP
  73. Years, months, weeks, days, hours and minutes are organized in steps with non constant intervals\&. \fBQwtDateScaleEngine\fP classifies intervals and aligns the boundaries and tick positions according to this classification\&.
  74. .PP
  75. \fBQwtDateScaleEngine\fP 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\&.
  76. .PP
  77. 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 \fBQwtDate::toDateTime()\fP\&.
  78. .PP
  79. \fBSee also\fP
  80. .RS 4
  81. \fBQwtDate\fP, \fBQwtPlot::setAxisScaleEngine()\fP, \fBQwtAbstractScale::setScaleEngine()\fP
  82. .RE
  83. .PP
  84. .SH "Constructor & Destructor Documentation"
  85. .PP
  86. .SS "QwtDateScaleEngine::QwtDateScaleEngine (Qt::TimeSpec timeSpec = \fCQt::LocalTime\fP)"
  87. .PP
  88. 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 \fBQwtDate::FirstThursday\fP\&.
  89. .PP
  90. \fBParameters\fP
  91. .RS 4
  92. \fItimeSpec\fP Time specification
  93. .RE
  94. .PP
  95. \fBSee also\fP
  96. .RS 4
  97. \fBsetTimeSpec()\fP, \fBsetMaxWeeks()\fP, \fBsetWeek0Type()\fP
  98. .RE
  99. .PP
  100. .SH "Member Function Documentation"
  101. .PP
  102. .SS "QDateTime QwtDateScaleEngine::alignDate (const QDateTime & dateTime, double stepSize, \fBQwtDate::IntervalType\fP intervalType, bool up) const\fC [protected]\fP, \fC [virtual]\fP"
  103. Align a date/time value for a step size
  104. .PP
  105. 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 ) \fBalignDate()\fP has to be overloaded\&.
  106. .PP
  107. \fBParameters\fP
  108. .RS 4
  109. \fIdateTime\fP Date/time value
  110. .br
  111. \fIstepSize\fP Step size
  112. .br
  113. \fIintervalType\fP Interval type
  114. .br
  115. \fIup\fP When true dateTime is ceiled - otherwise it is floored
  116. .RE
  117. .PP
  118. \fBReturns\fP
  119. .RS 4
  120. Aligned date/time value
  121. .RE
  122. .PP
  123. .SS "void QwtDateScaleEngine::autoScale (int maxNumSteps, double & x1, double & x2, double & stepSize) const\fC [virtual]\fP"
  124. Align and divide an interval
  125. .PP
  126. The algorithm aligns and divides the interval into steps\&.
  127. .PP
  128. Datetime interval divisions are usually not equidistant and the calculated stepSize can only be used as an approximation for the steps calculated by \fBdivideScale()\fP\&.
  129. .PP
  130. \fBParameters\fP
  131. .RS 4
  132. \fImaxNumSteps\fP Max\&. number of steps
  133. .br
  134. \fIx1\fP First limit of the interval (In/Out)
  135. .br
  136. \fIx2\fP Second limit of the interval (In/Out)
  137. .br
  138. \fIstepSize\fP Step size (Out)
  139. .RE
  140. .PP
  141. \fBSee also\fP
  142. .RS 4
  143. \fBQwtScaleEngine::setAttribute()\fP
  144. .RE
  145. .PP
  146. .PP
  147. Reimplemented from \fBQwtLinearScaleEngine\fP\&.
  148. .SS "\fBQwtScaleDiv\fP QwtDateScaleEngine::divideScale (double x1, double x2, int maxMajorSteps, int maxMinorSteps, double stepSize = \fC0\&.0\fP) const\fC [virtual]\fP"
  149. .PP
  150. Calculate a scale division for a date/time interval\&.
  151. .PP
  152. \fBParameters\fP
  153. .RS 4
  154. \fIx1\fP First interval limit
  155. .br
  156. \fIx2\fP Second interval limit
  157. .br
  158. \fImaxMajorSteps\fP Maximum for the number of major steps
  159. .br
  160. \fImaxMinorSteps\fP Maximum number of minor steps
  161. .br
  162. \fIstepSize\fP Step size\&. If stepSize == 0, the scaleEngine calculates one\&.
  163. .RE
  164. .PP
  165. \fBReturns\fP
  166. .RS 4
  167. Calculated scale division
  168. .RE
  169. .PP
  170. .PP
  171. Reimplemented from \fBQwtLinearScaleEngine\fP\&.
  172. .SS "\fBQwtDate::IntervalType\fP QwtDateScaleEngine::intervalType (const QDateTime & minDate, const QDateTime & maxDate, int maxSteps) const\fC [virtual]\fP"
  173. Classification of a date/time interval division
  174. .PP
  175. \fBParameters\fP
  176. .RS 4
  177. \fIminDate\fP Minimum ( = earlier ) of the interval
  178. .br
  179. \fImaxDate\fP Maximum ( = later ) of the interval
  180. .br
  181. \fImaxSteps\fP Maximum for the number of steps
  182. .RE
  183. .PP
  184. \fBReturns\fP
  185. .RS 4
  186. Interval classification
  187. .RE
  188. .PP
  189. .SS "int QwtDateScaleEngine::maxWeeks () const"
  190. .PP
  191. \fBReturns\fP
  192. .RS 4
  193. Upper limit for the number of weeks, when an interval can be classified as Qt::Week\&.
  194. .RE
  195. .PP
  196. \fBSee also\fP
  197. .RS 4
  198. \fBsetMaxWeeks()\fP, \fBweek0Type()\fP
  199. .RE
  200. .PP
  201. .SS "void QwtDateScaleEngine::setMaxWeeks (int weeks)"
  202. Set a upper limit for the number of weeks, when an interval can be classified as Qt::Week\&.
  203. .PP
  204. The default setting is 4 weeks\&.
  205. .PP
  206. \fBParameters\fP
  207. .RS 4
  208. \fIweeks\fP Upper limit for the number of weeks
  209. .RE
  210. .PP
  211. \fBNote\fP
  212. .RS 4
  213. In business charts a year is often divided into weeks [1-52]
  214. .RE
  215. .PP
  216. \fBSee also\fP
  217. .RS 4
  218. \fBmaxWeeks()\fP, \fBsetWeek0Type()\fP
  219. .RE
  220. .PP
  221. .SS "void QwtDateScaleEngine::setTimeSpec (Qt::TimeSpec timeSpec)"
  222. Set the time specification used by the engine
  223. .PP
  224. \fBParameters\fP
  225. .RS 4
  226. \fItimeSpec\fP Time specification
  227. .RE
  228. .PP
  229. \fBSee also\fP
  230. .RS 4
  231. \fBtimeSpec()\fP, \fBsetUtcOffset()\fP, \fBtoDateTime()\fP
  232. .RE
  233. .PP
  234. .SS "void QwtDateScaleEngine::setUtcOffset (int seconds)"
  235. Set the offset in seconds from Coordinated Universal Time
  236. .PP
  237. \fBParameters\fP
  238. .RS 4
  239. \fIseconds\fP Offset in seconds
  240. .RE
  241. .PP
  242. \fBNote\fP
  243. .RS 4
  244. The offset has no effect beside for the time specification Qt::OffsetFromUTC\&.
  245. .RE
  246. .PP
  247. \fBSee also\fP
  248. .RS 4
  249. QDate::utcOffset(), \fBsetTimeSpec()\fP, \fBtoDateTime()\fP
  250. .RE
  251. .PP
  252. .SS "void QwtDateScaleEngine::setWeek0Type (\fBQwtDate::Week0Type\fP week0Type)"
  253. Sets how to identify the first week of a year\&.
  254. .PP
  255. \fBParameters\fP
  256. .RS 4
  257. \fIweek0Type\fP Mode how to identify the first week of a year
  258. .RE
  259. .PP
  260. \fBSee also\fP
  261. .RS 4
  262. \fBweek0Type()\fP, \fBsetMaxWeeks()\fP
  263. .RE
  264. .PP
  265. \fBNote\fP
  266. .RS 4
  267. week0Type has no effect beside for intervals classified as \fBQwtDate::Week\fP\&.
  268. .RE
  269. .PP
  270. .SS "Qt::TimeSpec QwtDateScaleEngine::timeSpec () const"
  271. .PP
  272. \fBReturns\fP
  273. .RS 4
  274. Time specification used by the engine
  275. .RE
  276. .PP
  277. \fBSee also\fP
  278. .RS 4
  279. \fBsetTimeSpec()\fP, \fButcOffset()\fP, \fBtoDateTime()\fP
  280. .RE
  281. .PP
  282. .SS "QDateTime QwtDateScaleEngine::toDateTime (double value) const"
  283. Translate a double value into a QDateTime object\&.
  284. .PP
  285. For QDateTime result is bounded by \fBQwtDate::minDate()\fP and \fBQwtDate::maxDate()\fP
  286. .PP
  287. \fBReturns\fP
  288. .RS 4
  289. QDateTime object initialized with \fBtimeSpec()\fP and \fButcOffset()\fP\&.
  290. .RE
  291. .PP
  292. \fBSee also\fP
  293. .RS 4
  294. \fBtimeSpec()\fP, \fButcOffset()\fP, \fBQwtDate::toDateTime()\fP
  295. .RE
  296. .PP
  297. .SS "int QwtDateScaleEngine::utcOffset () const"
  298. .PP
  299. \fBReturns\fP
  300. .RS 4
  301. Offset in seconds from Coordinated Universal Time
  302. .RE
  303. .PP
  304. \fBNote\fP
  305. .RS 4
  306. The offset has no effect beside for the time specification Qt::OffsetFromUTC\&.
  307. .RE
  308. .PP
  309. \fBSee also\fP
  310. .RS 4
  311. QDate::setUtcOffset(), \fBsetTimeSpec()\fP, \fBtoDateTime()\fP
  312. .RE
  313. .PP
  314. .SS "\fBQwtDate::Week0Type\fP QwtDateScaleEngine::week0Type () const"
  315. .PP
  316. \fBReturns\fP
  317. .RS 4
  318. Setting how to identify the first week of a year\&.
  319. .RE
  320. .PP
  321. \fBSee also\fP
  322. .RS 4
  323. \fBsetWeek0Type()\fP, \fBmaxWeeks()\fP
  324. .RE
  325. .PP
  326. .SH "Author"
  327. .PP
  328. Generated automatically by Doxygen for Qwt User's Guide from the source code\&.