OpenMS  2.8.0
Public Types | Public Slots | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AxisWidget Class Reference

Widget that represents an axis of a graph. More...

#include <OpenMS/VISUAL/AxisWidget.h>

Inheritance diagram for AxisWidget:
[legend]
Collaboration diagram for AxisWidget:
[legend]

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 (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 StringgetLegend ()
 returns the actual legend text More...
 
const GridVectorgridLines () 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...
 

Detailed Description

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.

Member Typedef Documentation

◆ GridVector

typedef std::vector<std::vector<double> > GridVector

Type definitions.

Vector of vector of doubles that defines the grid

Constructor & Destructor Documentation

◆ AxisWidget()

AxisWidget ( AxisPainter::Alignment  alignment,
const char *  legend = "",
QWidget parent = nullptr 
)

constructor

◆ ~AxisWidget()

~AxisWidget ( )
override

destructor

Member Function Documentation

◆ getAxisMaximum()

double getAxisMaximum ( ) const

returns the maximum value displayed on the axis

◆ getAxisMinimum()

double getAxisMinimum ( ) const

returns the minimum value displayed on the axis

◆ getLegend()

const String& getLegend ( )

returns the actual legend text

◆ gridLines()

const GridVector& gridLines ( ) const

returns the currently used grid lines

◆ hasInverseOrientation()

bool hasInverseOrientation ( ) const

returns if the axis label is displayed in inverse order

◆ isLegendShown()

bool isLegendShown ( ) const

returns true if legend is shown

◆ isLogScale()

bool isLogScale ( ) const

returns true if the axis has logarithmic scale

◆ margin()

UInt margin ( ) const

returns the margin

◆ paint()

void paint ( QPainter *  painter,
QPaintEvent *  e 
)

Actual painting takes place here.

◆ paintEvent()

void paintEvent ( QPaintEvent *  )
overrideprotected

Reimplemented Qt event (calls paint with "this")

◆ setAllowShortNumbers()

void setAllowShortNumbers ( bool  short_nums)

set true to allow for shortened numbers (with k/M/G units) on the axis label

◆ setAxisBounds

void setAxisBounds ( double  min,
double  max 
)
slot

sets min/max of the axis

◆ setInverseOrientation()

void setInverseOrientation ( bool  inverse_orientation)

set true to display the axis label in inverse order (left to right or bottom to top)

◆ setLegend()

void setLegend ( const String legend)

sets the legend text

Referenced by TOPPViewBase::showCurrentPeaksAsIonMobility().

◆ setLogScale()

void setLogScale ( bool  is_log)

sets the axis to logarithmic scale

◆ setMargin()

void setMargin ( UInt  size)

sets the margin on the top/right side (default is 0)

◆ setTickLevel

void setTickLevel ( UInt  level)
slot

set maximum number of tick levels ('1' or '2', default: '2')

◆ showLegend()

void showLegend ( bool  show_legend)

enable the display of the legend (default true)

Member Data Documentation

◆ alignment_

AxisPainter::Alignment alignment_
protected

Position of the axis (right, left, top, down as defined in ALIGNMENT_ENUM)

◆ allow_short_numbers_

bool allow_short_numbers_
protected

true if k/M/G units can be used

◆ grid_line_

GridVector grid_line_
protected

Vector that defines the position of the ticks/gridlines and the shown values on axis.

◆ is_inverse_orientation_

bool is_inverse_orientation_
protected

true if axis label are displayed in inverse order (left to right or bottom to top)

◆ is_log_

bool is_log_
protected

format of axis scale (linear or logarithmic)

◆ legend_

String legend_
protected

text/unit on axis

◆ margin_

UInt margin_
protected

margin of axis

◆ max_

double max_
protected

maximum value on the axis

◆ min_

double min_
protected

minimum value on the axis

◆ show_legend_

bool show_legend_
protected

display of legend enabled or not

◆ tick_level_

UInt tick_level_
protected

maximum number of tick levels (default=2)