#include <ScaleDraw.h>
Public Types | |
enum | NameFormat { ShortName, LongName, Initial } |
enum | NumericFormat { Automatic, Decimal, Scientific, Superscripts } |
enum | ScaleType { Numeric = 0, Text = 1, Day = 2, Month = 3, Time = 4, Date = 5, ColHeader = 6 } |
enum | TicksStyle { None = 0, Out = 1, Both = 2, In = 3 } |
Public Member Functions | |
int | axis () const |
QDateTime | dateTimeOrigin () |
QString | format () |
QString | formatString () |
QString | formula () |
virtual QwtText | label (double value) const |
void | labelFormat (char &f, int &prec) const |
Return the number format for the major scale labels. | |
NumericFormat | labelNumericFormat () |
int | labelNumericPrecision () |
QStringList | labelsList () |
int | majorTicksStyle () |
int | minorTicksStyle () |
NameFormat | nameFormat () |
ScaleDraw (Graph *plot, const QStringList &labels, const QString &format, ScaleType type=Text) | |
ScaleDraw (Graph *plot, const QString &formula=QString::null) | |
ScaleDraw (Graph *plot, ScaleDraw *sd) | |
Constructs a new scale draw which is a clone of sd. | |
ScaleType | scaleType () |
void | setDateFormat (const QDateTime &d, const QString &format) |
void | setDateTimeOrigin (const QDateTime &d) |
void | setDayFormat (NameFormat format) |
void | setFormula (const QString &formula) |
void | setMajorTicksStyle (TicksStyle type) |
void | setMinorTicksStyle (TicksStyle type) |
void | setMonthFormat (NameFormat format) |
void | setNumericFormat (NumericFormat format) |
void | setNumericPrecision (int prec) |
void | setScaleType (ScaleType type) |
void | setSelected (bool select=true) |
void | setTimeFormat (const QTime &t, const QString &format) |
double | transformValue (double value) const |
Protected Member Functions | |
virtual void | draw (QPainter *, const QPalette &) const |
virtual void | drawBackbone (QPainter *painter) const |
void | drawBreak (QPainter *) const |
virtual void | drawLabel (QPainter *painter, double value) const |
virtual void | drawTick (QPainter *p, double value, int len) const |
Private Attributes | |
QDateTime | d_date_time_origin |
Stores the date-time origin used to calculate labels for Date/Time scales. | |
char | d_fmt |
Numerical format specification. | |
QString | d_format_info |
Stores extra format information:. | |
QString | d_formula |
A mathematical expression used to calculate the label values. | |
int | d_majTicks |
Max ticks style. | |
int | d_minTicks |
Min ticks style. | |
NameFormat | d_name_format |
Stores the scale name format for Day and Month scales. | |
NumericFormat | d_numeric_format |
Stores the scale numeric format: Automatic, Decimal, Scientific, Superscripts. | |
Graph * | d_plot |
Pointer to the parent plot. | |
int | d_prec |
Numerical precision. | |
bool | d_selected |
Flag telling if the scale labels are selected (a blue frame is drawn around each labels if true). | |
QStringList | d_text_labels |
Stores the labels for Txt scales. | |
ScaleType | d_type |
Stores the scale type (numeric, text, etc...). See: enum NumericFormat. |
enum ScaleDraw::ScaleType |
Constructs a new scale draw which is a clone of sd.
References d_date_time_origin, d_fmt, d_format_info, d_formula, d_majTicks, d_minTicks, d_name_format, d_numeric_format, d_prec, d_selected, d_text_labels, and d_type.
ScaleDraw::ScaleDraw | ( | Graph * | plot, | |
const QString & | formula = QString::null | |||
) |
ScaleDraw::ScaleDraw | ( | Graph * | plot, | |
const QStringList & | labels, | |||
const QString & | format, | |||
ScaleType | type = Text | |||
) |
int ScaleDraw::axis | ( | ) | const |
Referenced by drawBackbone(), drawBreak(), drawLabel(), drawTick(), and label().
QDateTime ScaleDraw::dateTimeOrigin | ( | ) | [inline] |
References d_date_time_origin.
Referenced by AxesDialog::updatePlot(), and AxesDialog::updateScale().
void ScaleDraw::draw | ( | QPainter * | painter, | |
const QPalette & | palette | |||
) | const [protected, virtual] |
References drawBreak().
void ScaleDraw::drawBackbone | ( | QPainter * | painter | ) | const [protected, virtual] |
References axis(), ScaleEngine::axisBreakLeft(), ScaleEngine::axisBreakRight(), d_plot, and ScaleEngine::hasBreak().
void ScaleDraw::drawBreak | ( | QPainter * | painter | ) | const [protected] |
References axis(), ScaleEngine::axisBreakLeft(), ScaleEngine::axisBreakRight(), d_plot, ScaleEngine::hasBreak(), and ScaleEngine::hasBreakDecoration().
Referenced by draw().
void ScaleDraw::drawLabel | ( | QPainter * | painter, | |
double | value | |||
) | const [protected, virtual] |
References axis(), ScaleEngine::axisBreakLeft(), ScaleEngine::axisBreakRight(), d_plot, d_selected, and ScaleEngine::hasBreak().
void ScaleDraw::drawTick | ( | QPainter * | p, | |
double | value, | |||
int | len | |||
) | const [protected, virtual] |
References axis(), ScaleEngine::axisBreakLeft(), ScaleEngine::axisBreakRight(), d_majTicks, d_minTicks, d_plot, ScaleEngine::hasBreak(), In, and None.
QString ScaleDraw::format | ( | ) | [inline] |
QString ScaleDraw::formatString | ( | ) |
References d_date_time_origin, d_format_info, d_type, Date, and Time.
Referenced by Graph::copy(), Graph::saveAxesLabelsType(), and Graph::showAxis().
QString ScaleDraw::formula | ( | ) | [inline] |
References d_formula.
Referenced by Graph::axisFormula(), Graph::copy(), Graph::saveAxesFormulas(), Graph::setLabelsNumericFormat(), and Graph::showAxis().
QwtText ScaleDraw::label | ( | double | value | ) | const [virtual] |
References axis(), ScaleEngine::axisBreakLeft(), ScaleEngine::axisBreakRight(), ColHeader, d_date_time_origin, d_fmt, d_format_info, d_name_format, d_numeric_format, d_plot, d_prec, d_text_labels, d_type, Date, Day, ScaleEngine::hasBreak(), Initial, LongName, Month, Graph::multiLayer(), Numeric, ShortName, Superscripts, Text, Time, and transformValue().
void ScaleDraw::labelFormat | ( | char & | f, | |
int & | prec | |||
) | const |
Return the number format for the major scale labels.
Format character and precision have the same meaning as for sprintf().
f | format character 'e', 'f' or 'g' | |
prec |
|
Referenced by Graph::axisLabelFormat().
NumericFormat ScaleDraw::labelNumericFormat | ( | ) | [inline] |
int ScaleDraw::labelNumericPrecision | ( | ) | [inline] |
QStringList ScaleDraw::labelsList | ( | ) | [inline] |
int ScaleDraw::majorTicksStyle | ( | ) | [inline] |
int ScaleDraw::minorTicksStyle | ( | ) | [inline] |
NameFormat ScaleDraw::nameFormat | ( | ) | [inline] |
ScaleType ScaleDraw::scaleType | ( | ) | [inline] |
void ScaleDraw::setDateFormat | ( | const QDateTime & | d, | |
const QString & | format | |||
) |
References d_date_time_origin, d_format_info, d_type, and Date.
Referenced by Graph::setLabelsDateTimeFormat().
void ScaleDraw::setDateTimeOrigin | ( | const QDateTime & | d | ) | [inline] |
void ScaleDraw::setDayFormat | ( | NameFormat | format | ) |
void ScaleDraw::setFormula | ( | const QString & | formula | ) | [inline] |
void ScaleDraw::setMajorTicksStyle | ( | TicksStyle | type | ) | [inline] |
void ScaleDraw::setMinorTicksStyle | ( | TicksStyle | type | ) | [inline] |
void ScaleDraw::setMonthFormat | ( | NameFormat | format | ) |
void ScaleDraw::setNumericFormat | ( | NumericFormat | format | ) |
References Automatic, d_fmt, d_numeric_format, d_type, Decimal, Numeric, Scientific, and Superscripts.
Referenced by Graph::setLabelsNumericFormat().
void ScaleDraw::setNumericPrecision | ( | int | prec | ) | [inline] |
void ScaleDraw::setSelected | ( | bool | select = true |
) | [inline] |
void ScaleDraw::setTimeFormat | ( | const QTime & | t, | |
const QString & | format | |||
) |
References d_date_time_origin, d_format_info, d_type, and Time.
Referenced by Graph::setLabelsDateTimeFormat().
double ScaleDraw::transformValue | ( | double | value | ) | const |
QDateTime ScaleDraw::d_date_time_origin [private] |
Stores the date-time origin used to calculate labels for Date/Time scales.
Referenced by dateTimeOrigin(), formatString(), label(), ScaleDraw(), setDateFormat(), setDateTimeOrigin(), and setTimeFormat().
char ScaleDraw::d_fmt [private] |
Numerical format specification.
Referenced by label(), labelFormat(), ScaleDraw(), and setNumericFormat().
QString ScaleDraw::d_format_info [private] |
Stores extra format information:.
Referenced by format(), formatString(), label(), ScaleDraw(), setDateFormat(), and setTimeFormat().
QString ScaleDraw::d_formula [private] |
A mathematical expression used to calculate the label values.
Referenced by formula(), ScaleDraw(), setFormula(), and transformValue().
int ScaleDraw::d_majTicks [private] |
Max ticks style.
Referenced by drawTick(), majorTicksStyle(), ScaleDraw(), and setMajorTicksStyle().
int ScaleDraw::d_minTicks [private] |
Min ticks style.
Referenced by drawTick(), minorTicksStyle(), ScaleDraw(), and setMinorTicksStyle().
NameFormat ScaleDraw::d_name_format [private] |
Stores the scale name format for Day and Month scales.
Referenced by label(), nameFormat(), ScaleDraw(), setDayFormat(), and setMonthFormat().
NumericFormat ScaleDraw::d_numeric_format [private] |
Stores the scale numeric format: Automatic, Decimal, Scientific, Superscripts.
Referenced by label(), labelNumericFormat(), ScaleDraw(), and setNumericFormat().
Graph* ScaleDraw::d_plot [private] |
Pointer to the parent plot.
Referenced by drawBackbone(), drawBreak(), drawLabel(), drawTick(), and label().
int ScaleDraw::d_prec [private] |
Numerical precision.
Referenced by label(), labelFormat(), labelNumericPrecision(), ScaleDraw(), and setNumericPrecision().
bool ScaleDraw::d_selected [private] |
Flag telling if the scale labels are selected (a blue frame is drawn around each labels if true).
Referenced by drawLabel(), ScaleDraw(), and setSelected().
QStringList ScaleDraw::d_text_labels [private] |
ScaleType ScaleDraw::d_type [private] |
Stores the scale type (numeric, text, etc...). See: enum NumericFormat.
Referenced by formatString(), label(), ScaleDraw(), scaleType(), setDateFormat(), setDayFormat(), setMonthFormat(), setNumericFormat(), setScaleType(), and setTimeFormat().