OpenMS
|
Widget that represents an axis of a graph. More...
#include <OpenMS/VISUAL/AxisWidget.h>
Public Types | |
typedef std::vector< std::vector< double > > | GridVector |
Type definitions. More... | |
Public Slots | |
void | setAxisBounds (double min, double max) |
sets min/max of the axis More... | |
void | setTickLevel (UInt level) |
set maximum number of tick levels ('1' or '2', default: '2') More... | |
Public Member Functions | |
AxisWidget (const AxisPainter::Alignment alignment, const char *legend="", QWidget *parent=nullptr) | |
constructor More... | |
~AxisWidget () override | |
destructor More... | |
void | setMargin (UInt size) |
sets the margin on the top/right side (default is 0) More... | |
UInt | margin () const |
returns the margin More... | |
void | showLegend (bool show_legend) |
enable the display of the legend (default true) More... | |
bool | isLegendShown () const |
returns true if legend is shown More... | |
void | setLegend (const String &legend) |
sets the legend text More... | |
const String & | getLegend () const |
returns the actual legend text More... | |
const GridVector & | gridLines () const |
returns the currently used grid lines More... | |
void | setLogScale (bool is_log) |
sets the axis to logarithmic scale More... | |
bool | isLogScale () const |
returns true if the axis has logarithmic scale More... | |
void | setInverseOrientation (bool inverse_orientation) |
set true to display the axis label in inverse order (left to right or bottom to top) More... | |
bool | hasInverseOrientation () const |
returns if the axis label is displayed in inverse order More... | |
void | setAllowShortNumbers (bool short_nums) |
set true to allow for shortened numbers (with k/M/G units) on the axis label More... | |
double | getAxisMinimum () const |
returns the minimum value displayed on the axis More... | |
double | getAxisMaximum () const |
returns the maximum value displayed on the axis More... | |
void | paint (QPainter *painter, QPaintEvent *e) |
Actual painting takes place here. More... | |
Protected Member Functions | |
void | paintEvent (QPaintEvent *) override |
Reimplemented Qt event (calls paint with "this") More... | |
Protected Attributes | |
GridVector | grid_line_ |
Vector that defines the position of the ticks/gridlines and the shown values on axis. More... | |
bool | is_log_ |
format of axis scale (linear or logarithmic) More... | |
bool | show_legend_ |
display of legend enabled or not More... | |
AxisPainter::Alignment | alignment_ |
Position of the axis (right, left, top, down as defined in ALIGNMENT_ENUM) More... | |
bool | is_inverse_orientation_ |
true if axis label are displayed in inverse order (left to right or bottom to top) More... | |
UInt | margin_ |
margin of axis More... | |
double | min_ |
minimum value on the axis More... | |
double | max_ |
maximum value on the axis More... | |
String | legend_ |
text/unit on axis More... | |
UInt | tick_level_ |
maximum number of tick levels (default=2) More... | |
bool | allow_short_numbers_ |
true if k/M/G units can be used More... | |
Widget that represents an axis of a graph.
Additional to ticks and tick values a label e.g. the unit can be displayed. It supports both linear and logarithmic scale.
The above image shows a horizontal example axis.
typedef std::vector<std::vector<double> > GridVector |
Type definitions.
Vector of vector of doubles that defines the grid
AxisWidget | ( | const AxisPainter::Alignment | alignment, |
const char * | legend = "" , |
||
QWidget * | parent = nullptr |
||
) |
constructor
|
override |
destructor
double getAxisMaximum | ( | ) | const |
returns the maximum value displayed on the axis
double getAxisMinimum | ( | ) | const |
returns the minimum value displayed on the axis
const String& getLegend | ( | ) | const |
returns the actual legend text
const GridVector& gridLines | ( | ) | const |
returns the currently used grid lines
bool hasInverseOrientation | ( | ) | const |
returns if the axis label is displayed in inverse order
bool isLegendShown | ( | ) | const |
returns true if legend is shown
bool isLogScale | ( | ) | const |
returns true if the axis has logarithmic scale
UInt margin | ( | ) | const |
returns the margin
void paint | ( | QPainter * | painter, |
QPaintEvent * | e | ||
) |
Actual painting takes place here.
|
overrideprotected |
Reimplemented Qt event (calls paint with "this")
void setAllowShortNumbers | ( | bool | short_nums | ) |
set true to allow for shortened numbers (with k/M/G units) on the axis label
|
slot |
sets min/max of the axis
void setInverseOrientation | ( | bool | inverse_orientation | ) |
set true to display the axis label in inverse order (left to right or bottom to top)
void setLegend | ( | const String & | legend | ) |
sets the legend text
void setLogScale | ( | bool | is_log | ) |
sets the axis to logarithmic scale
void setMargin | ( | UInt | size | ) |
sets the margin on the top/right side (default is 0)
|
slot |
set maximum number of tick levels ('1' or '2', default: '2')
void showLegend | ( | bool | show_legend | ) |
enable the display of the legend (default true)
|
protected |
Position of the axis (right, left, top, down as defined in ALIGNMENT_ENUM)
|
protected |
true if k/M/G units can be used
|
protected |
Vector that defines the position of the ticks/gridlines and the shown values on axis.
|
protected |
true if axis label are displayed in inverse order (left to right or bottom to top)
|
protected |
format of axis scale (linear or logarithmic)
|
protected |
text/unit on axis
|
protected |
margin of axis
|
protected |
maximum value on the axis
|
protected |
minimum value on the axis
|
protected |
display of legend enabled or not
|
protected |
maximum number of tick levels (default=2)