Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::API::PlotAxis Class Reference

Deals with formatting a label for a plot axis for a given type of workspace. More...

#include <PlotAxis.h>

Public Member Functions

 PlotAxis ()=delete
 Disable default constructor. More...
 
 PlotAxis (const bool plottingDistribution, const Mantid::API::MatrixWorkspace &workspace)
 Constructor with just a workspace (reverse order to above so compiler doesn't convert a a bool to an size_t and call the wrong thing. More...
 
 PlotAxis (const Mantid::API::IMDWorkspace &workspace, const size_t index)
 Constructor with workspace & axis index. More...
 
 PlotAxis (const Mantid::Geometry::IMDDimension &dim)
 Constructor with an IMDDimension. More...
 
QString title () const
 Create a new axis title. More...
 

Private Member Functions

void titleFromDimension (const Mantid::Geometry::IMDDimension &dim)
 Creates a title suitable for an axis attached to the given dimension. More...
 
void titleFromIndex (const Mantid::API::IMDWorkspace &workspace, const size_t index)
 Creates a title suitable for an axis attached to the given index. More...
 
void titleFromYData (const Mantid::API::MatrixWorkspace &workspace, const bool plottingDistribution)
 Creates a title suitable for the Y data values. More...
 

Private Attributes

QString m_title
 Title. More...
 

Detailed Description

Deals with formatting a label for a plot axis for a given type of workspace.

Definition at line 23 of file PlotAxis.h.

Constructor & Destructor Documentation

◆ PlotAxis() [1/4]

MantidQt::API::PlotAxis::PlotAxis ( const Mantid::API::IMDWorkspace workspace,
const size_t  index 
)

Constructor with workspace & axis index.

The title will be filled with the caption & units from the given Axis object of the workspace.

Parameters
workspaceThe workspace containing the axis information
indexIndex of the axis in the workspace to inspect

Definition at line 53 of file PlotAxis.cpp.

References index, titleFromIndex(), and workspace.

◆ PlotAxis() [2/4]

MantidQt::API::PlotAxis::PlotAxis ( const Mantid::Geometry::IMDDimension dim)

Constructor with an IMDDimension.

The title will be filled with the caption & units from the given dimension object.

Parameters
dimA dimension object, usually from a workspace

Definition at line 65 of file PlotAxis.cpp.

References titleFromDimension().

◆ PlotAxis() [3/4]

MantidQt::API::PlotAxis::PlotAxis ( const bool  plottingDistribution,
const Mantid::API::MatrixWorkspace workspace 
)

Constructor with just a workspace (reverse order to above so compiler doesn't convert a a bool to an size_t and call the wrong thing.

The title will be filled with the caption & label for the Y data values within the workspace, ~ the Z axis.

Parameters
plottingDistributionIf true, the Y axis has been divided by the bin width
workspaceThe workspace containing the Y title information

Definition at line 74 of file PlotAxis.cpp.

References titleFromYData(), and workspace.

◆ PlotAxis() [4/4]

MantidQt::API::PlotAxis::PlotAxis ( )
delete

Disable default constructor.

Member Function Documentation

◆ title()

QString MantidQt::API::PlotAxis::title ( ) const

Create a new axis title.

Returns
A new title for this axis

Definition at line 81 of file PlotAxis.cpp.

References m_title.

◆ titleFromDimension()

void MantidQt::API::PlotAxis::titleFromDimension ( const Mantid::Geometry::IMDDimension dim)
private

Creates a title suitable for an axis attached to the given dimension.

Parameters
dimA dimension object that encapsulates the axis data

Definition at line 98 of file PlotAxis.cpp.

References Mantid::Geometry::IMDDimension::getName(), Mantid::Geometry::IMDDimension::getUnits(), m_title, and MantidQt::API::toQStringInternal().

Referenced by PlotAxis(), and titleFromIndex().

◆ titleFromIndex()

void MantidQt::API::PlotAxis::titleFromIndex ( const Mantid::API::IMDWorkspace workspace,
const size_t  index 
)
private

Creates a title suitable for an axis attached to the given index.

Parameters
workspaceThe workspace containing the axis information
indexIndex of the axis in the workspace to inspect

Definition at line 87 of file PlotAxis.cpp.

References index, m_title, titleFromDimension(), and workspace.

Referenced by PlotAxis().

◆ titleFromYData()

void MantidQt::API::PlotAxis::titleFromYData ( const Mantid::API::MatrixWorkspace workspace,
const bool  plottingDistribution 
)
private

Creates a title suitable for the Y data values.

Constructs a title using the unicode methods of the UnitLabel.

Parameters
workspaceThe workspace containing the Y title information
plottingDistributionIf true, the Y axis has been divided by the bin width

Definition at line 116 of file PlotAxis.cpp.

References m_title, and workspace.

Referenced by PlotAxis().

Member Data Documentation

◆ m_title

QString MantidQt::API::PlotAxis::m_title
private

Title.

Definition at line 49 of file PlotAxis.h.

Referenced by title(), titleFromDimension(), titleFromIndex(), and titleFromYData().


The documentation for this class was generated from the following files: