![]() |
Gra zręcznościowa „Straszna Epidemia"
V1.2
Projekt Wizualizacja Danych Sensorycznych Kewin Gałuszka rok akademicki 2019/2020
|
Specialized axis ticker for time spans in units of milliseconds to days. Więcej...
#include <qcustomplot.h>
Typy publiczne | |
enum | TimeUnit { tuMilliseconds, tuSeconds, tuMinutes, tuHours, tuDays } |
![]() | |
enum | TickStepStrategy { tssReadability, tssMeetTickCount } |
Metody publiczne | |
QCPAxisTickerTime () | |
QString | timeFormat () const |
int | fieldWidth (TimeUnit unit) const |
void | setTimeFormat (const QString &format) |
void | setFieldWidth (TimeUnit unit, int width) |
![]() | |
QCPAxisTicker () | |
virtual | ~QCPAxisTicker () |
TickStepStrategy | tickStepStrategy () const |
int | tickCount () const |
double | tickOrigin () const |
void | setTickStepStrategy (TickStepStrategy strategy) |
void | setTickCount (int count) |
void | setTickOrigin (double origin) |
virtual void | generate (const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector< double > &ticks, QVector< double > *subTicks, QVector< QString > *tickLabels) |
Metody chronione | |
virtual double | getTickStep (const QCPRange &range) Q_DECL_OVERRIDE |
virtual int | getSubTickCount (double tickStep) Q_DECL_OVERRIDE |
virtual QString | getTickLabel (double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE |
void | replaceUnit (QString &text, TimeUnit unit, int value) const |
![]() | |
virtual QVector< double > | createTickVector (double tickStep, const QCPRange &range) |
virtual QVector< double > | createSubTickVector (int subTickCount, const QVector< double > &ticks) |
virtual QVector< QString > | createLabelVector (const QVector< double > &ticks, const QLocale &locale, QChar formatChar, int precision) |
void | trimTicks (const QCPRange &range, QVector< double > &ticks, bool keepOneOutlier) const |
double | pickClosest (double target, const QVector< double > &candidates) const |
double | getMantissa (double input, double *magnitude=0) const |
double | cleanMantissa (double input) const |
Atrybuty chronione | |
QString | mTimeFormat |
QHash< TimeUnit, int > | mFieldWidth |
TimeUnit | mSmallestUnit |
TimeUnit | mBiggestUnit |
QHash< TimeUnit, QString > | mFormatPattern |
![]() | |
TickStepStrategy | mTickStepStrategy |
int | mTickCount |
double | mTickOrigin |
Specialized axis ticker for time spans in units of milliseconds to days.
This QCPAxisTicker subclass generates ticks that corresponds to time intervals.
The format of the time display in the tick labels is controlled with setTimeFormat and setFieldWidth. The time coordinate is in the unit of seconds with respect to the time coordinate zero. Unlike with QCPAxisTickerDateTime, the ticks don't correspond to a specific calendar date and time.
The time can be displayed in milliseconds, seconds, minutes, hours and days. Depending on the largest available unit in the format specified with setTimeFormat, any time spans above will be carried in that largest unit. So for example if the format string is "%m:%s" and a tick at coordinate value 7815 (being 2 hours, 10 minutes and 15 seconds) is created, the resulting tick label will show "130:15" (130 minutes, 15 seconds). If the format string is "%h:%m:%s", the hour unit will be used and the label will thus be "02:10:15". Negative times with respect to the axis zero will carry a leading minus sign.
The ticker can be created and assigned to an axis like this:
Here is an example of a time axis providing time information in days, hours and minutes. Due to the axis range spanning a few days and the wanted tick count (setTickCount), the ticker decided to use tick steps of 12 hours:
The format string for this example is
Definicja w linii 1644 pliku qcustomplot.h.
Defines the logical units in which fractions of time spans can be expressed.
Wartości wyliczeń | |
---|---|
tuMilliseconds | Milliseconds, one thousandth of a second (%z in setTimeFormat) |
tuSeconds | Seconds (%s in setTimeFormat) |
tuMinutes | Minutes (%m in setTimeFormat) |
tuHours | Hours (%h in setTimeFormat) |
tuDays | Days (%d in setTimeFormat) |
Definicja w linii 1653 pliku qcustomplot.h.
QCPAxisTickerTime::QCPAxisTickerTime | ( | ) |
Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker.
Definicja w linii 6196 pliku qcustomplot.cpp.
|
inline |
Definicja w linii 1665 pliku qcustomplot.h.
|
protectedvirtual |
Reimplementowana z QCPAxisTicker.
Definicja w linii 6329 pliku qcustomplot.cpp.
|
protectedvirtual |
Reimplementowana z QCPAxisTicker.
Definicja w linii 6355 pliku qcustomplot.cpp.
|
protectedvirtual |
Reimplementowana z QCPAxisTicker.
Definicja w linii 6278 pliku qcustomplot.cpp.
|
protected |
void QCPAxisTickerTime::setFieldWidth | ( | QCPAxisTickerTime::TimeUnit | unit, |
int | width | ||
) |
Sets the field widh of the specified unit to be width digits, when displayed in the tick label. If the number for the specific unit is shorter than width, it will be padded with an according number of zeros to the left in order to reach the field width.
Definicja w linii 6264 pliku qcustomplot.cpp.
void QCPAxisTickerTime::setTimeFormat | ( | const QString & | format | ) |
Sets the format that will be used to display time in the tick labels.
The available patterns are:
The field width (zero padding) can be controlled for each unit with setFieldWidth.
The largest unit that appears in format will carry all the remaining time of a certain tick coordinate, even if it overflows the natural limit of the unit. For example, if %m is the largest unit it might become larger than 59 in order to consume larger time values. If on the other hand %h is available, the minutes will wrap around to zero after 59 and the time will carry to the hour digit.
Definicja w linii 6233 pliku qcustomplot.cpp.
|
inline |
Definicja w linii 1664 pliku qcustomplot.h.
|
protected |
Definicja w linii 1677 pliku qcustomplot.h.
|
protected |
Definicja w linii 1674 pliku qcustomplot.h.
|
protected |
Definicja w linii 1678 pliku qcustomplot.h.
|
protected |
Definicja w linii 1677 pliku qcustomplot.h.
|
protected |
Definicja w linii 1673 pliku qcustomplot.h.