#include <OpenMS/VISUAL/AxisWidget.h>
Additional to ticks and tick values a label e.g. the unit can be displayed. It supports both linear and logarithmic scale.
Public Types | |
enum | { TOP, BOTTOM, LEFT, RIGHT } |
Where the axis is placed. More... | |
typedef std::vector < std::vector< double > > | GridVector |
Vector of vector of doubles that defines the grid. | |
Public Slots | |
void | setAxisBounds (double min, double max) |
sets min/max of the axis | |
void | setTickLevel (UInt level) |
set maximum number of tick levels (1 <= level <= 3) | |
Public Member Functions | |
AxisWidget (UInt alignment, const char *legend="", QWidget *parent=0) | |
constructor | |
virtual | ~AxisWidget () |
destructor | |
void | setMargin (UInt size) |
sets the margin on the top/right side (default is 0) | |
UInt | margin () |
returns the margin | |
void | showLegend (bool show_legend) |
enable the display of the legend (default true) | |
bool | isLegendShown () const |
returns true if legend is shown | |
const GridVector & | gridLines () |
return constant reference to grid_line_ | |
void | setGridLines (std::vector< double > &) |
set user-defined gridlines (instead of using setAxisBounds to calculate GridLines) | |
void | setLogScale (bool is_log) |
sets the axis to logarithmic scale | |
bool | isLogScale () |
returns true if the axis has logarithmic scale | |
void | setLegend (const String &legend) |
sets the legend text | |
const String & | getLegend () |
returns the actual legend text | |
void | setInverseOrientation (bool inverse_orientation) |
set true to display the axis label in inverse order (left to right or bottom to top) | |
bool | hasInverseOrientation () |
returns if the axis label is displayed in inverse order | |
void | setAllowShortNumbers (bool short_nums=true) |
set true to allow for shortened numbers (with k/M/G units) on the axis label | |
double | getAxisMinimum () const |
returns the minimum value displayed on the axis | |
double | getAxisMaximum () const |
returns the maximum value displayed on the axis | |
void | setPenWidth (int p) |
sets the pen width for both text and lines and calls update() | |
Static Public Attributes | |
static enum OpenMS::AxisWidget:: { ... } | ALIGNMENT_ENUM |
Protected Member Functions | |
void | paintEvent (QPaintEvent *) |
see QWidget | |
double | scale_ (double x) |
Scale axis values to correct value (i.e. reverse log, unit conversion). | |
void | getShortenedNumber_ (QString &short_num, double number) |
sets short_num to a shortened string representation ("123.4 k/M/G") of number | |
Protected Attributes | |
GridVector | grid_line_ |
Vector that defines the position of the ticks/gridlines and the shown values on axis. | |
bool | is_log_ |
format of axis scale (linear or logarithmic) | |
bool | show_legend_ |
display of legend enabled or not | |
UInt | alignment_ |
Position of the axis (right, left, top, down as defined in ALIGNMENT_ENUM). | |
bool | inverse_orientation_ |
true if axis label are displayed in inverse order (left to right or bottom to top) | |
UInt | margin_ |
margin of axis | |
double | min_ |
minimum value on the axis | |
double | max_ |
maximum value on the axis | |
String | legend_ |
text/unit on axis | |
UInt | tick_level_ |
maximum number of tick levels (default=3) | |
UInt | pen_width_ |
drawing thicker lines (e.g. in printing) leads to better results | |
bool | allow_short_numbers_ |
true if k/M/G units can be used |
typedef std::vector<std::vector<double> > GridVector |
Vector of vector of doubles that defines the grid.
AxisWidget | ( | UInt | alignment, | |
const char * | legend = "" , |
|||
QWidget * | parent = 0 | |||
) |
constructor
virtual ~AxisWidget | ( | ) | [virtual] |
destructor
void setMargin | ( | UInt | size | ) |
sets the margin on the top/right side (default is 0)
UInt margin | ( | ) |
returns the margin
void showLegend | ( | bool | show_legend | ) |
enable the display of the legend (default true)
bool isLegendShown | ( | ) | const |
returns true if legend is shown
const GridVector& gridLines | ( | ) |
return constant reference to grid_line_
gridlines are calculated by setAxisBounds or set by the user using setGridLines
void setGridLines | ( | std::vector< double > & | ) |
set user-defined gridlines (instead of using setAxisBounds to calculate GridLines)
void setLogScale | ( | bool | is_log | ) |
sets the axis to logarithmic scale
bool isLogScale | ( | ) |
returns true if the axis has logarithmic scale
void setLegend | ( | const String & | legend | ) |
sets the legend text
const String& getLegend | ( | ) |
returns the actual legend text
void setInverseOrientation | ( | bool | inverse_orientation | ) |
set true to display the axis label in inverse order (left to right or bottom to top)
bool hasInverseOrientation | ( | ) |
returns if the axis label is displayed in inverse order
void setAllowShortNumbers | ( | bool | short_nums = true |
) |
set true to allow for shortened numbers (with k/M/G units) on the axis label
double getAxisMinimum | ( | ) | const [inline] |
returns the minimum value displayed on the axis
double getAxisMaximum | ( | ) | const [inline] |
returns the maximum value displayed on the axis
void setPenWidth | ( | int | p | ) | [inline] |
sets the pen width for both text and lines and calls update()
void setAxisBounds | ( | double | min, | |
double | max | |||
) | [slot] |
sets min/max of the axis
void setTickLevel | ( | UInt | level | ) | [slot] |
set maximum number of tick levels (1 <= level <= 3)
void paintEvent | ( | QPaintEvent * | ) | [protected] |
see QWidget
double scale_ | ( | double | x | ) | [inline, protected] |
Scale axis values to correct value (i.e. reverse log, unit conversion).
void getShortenedNumber_ | ( | QString & | short_num, | |
double | number | |||
) | [protected] |
sets short_num
to a shortened string representation ("123.4 k/M/G") of number
enum { ... } ALIGNMENT_ENUM [static] |
GridVector grid_line_ [protected] |
Vector that defines the position of the ticks/gridlines and the shown values on axis.
bool is_log_ [protected] |
format of axis scale (linear or logarithmic)
bool show_legend_ [protected] |
display of legend enabled or not
UInt alignment_ [protected] |
Position of the axis (right, left, top, down as defined in ALIGNMENT_ENUM).
bool inverse_orientation_ [protected] |
true if axis label are displayed in inverse order (left to right or bottom to top)
double min_ [protected] |
minimum value on the axis
double max_ [protected] |
maximum value on the axis
UInt tick_level_ [protected] |
maximum number of tick levels (default=3)
UInt pen_width_ [protected] |
drawing thicker lines (e.g. in printing) leads to better results
bool allow_short_numbers_ [protected] |
true if k/M/G units can be used
Generated Tue Apr 1 15:36:48 2008 -- using doxygen 1.5.4 | OpenMS / TOPP 1.1 |