Workspace 6.21.5
Public Types | Public Member Functions | Static Public Member Functions | List of all members
PlotItem Class Reference

Represents one set of data to be included in a Plot. More...

#include <DataAnalysis/Plot2D/plotitem.h>

Public Types

enum  ColorMode { UniformColor , UseColorScale }
 Specifies the way that the line will be colored. More...
 
enum  Glyph {
  NoGlyph , Point , Plus , Cross ,
  Asterisk , Circle , CirclePlus , CircleCross ,
  Square , Diamond , Hexagon , TriangleUp ,
  TriangleDown , TriangleLeft , TriangleRight , CircleFilled ,
  SquareFilled , DiamondFilled , HexagonFilled , TriangleUpFilled ,
  TriangleDownFilled , TriangleLeftFilled , TriangleRightFilled
}
 Specifies the glyph types supported by the plot engine. More...
 
enum  LineMode { OneLineThroughAllDataPoints , HorizontalLineThroughEachDataPoint , VerticalLineThroughEachDataPoint }
 Specifies the modes of line plotting supported by the plot engine. More...
 
enum  LineStyle {
  NoLine , SolidLine , LongDashLine , ShortDashLine ,
  DotLine , ShortDashDotLine , LongDashDotLine , ShortDashDotDotLine ,
  LongDashDotDotLine
}
 Specifies the line styles supported by the plot engine. More...
 
enum  LineType { Segment , Step }
 Specifies the line types supported by the plot engine. More...
 

Public Member Functions

 PlotItem ()
 
 PlotItem (const PlotItem &item)
 
 ~PlotItem ()
 
ColorMode getColorMode () const
 
const ColorScalegetColorScale () const
 
bool getFitPointsToXAxisLimits () const
 
bool getFitPointsToYAxisLimits () const
 
Glyph getGlyph () const
 
bool getIncludeInLegend () const
 
const QString & getLabel () const
 
LineMode getLineMode () const
 
LineStyle getLineStyle () const
 
LineType getLineType () const
 
bool getRenderPlotLine () const
 
const QVector< int > & getSectionsToRender () const
 
const DataSeriesgetSourceColor () const
 
const DataSeriesgetSourceX () const
 
const DataSeriesgetSourceY () const
 
const QColor & getUniformColor () const
 
bool isAntiAliasing () const
 
bool isEnabled () const
 
PlotItemoperator= (const PlotItem &item)
 
void setAntiAliasing (bool antiAliasing)
 
void setColorMode (ColorMode colorMode)
 
void setColorScale (const ColorScale &colorScale)
 
void setEnabled (bool enabled)
 
void setFitPointsToXAxisLimits (bool fit)
 
void setFitPointsToYAxisLimits (bool fit)
 
void setGlyph (Glyph glyph)
 
void setIncludeInLegend (bool includeInLegend)
 
void setLabel (const QString &label)
 
void setLineMode (LineMode lineMode)
 
void setLineStyle (LineStyle lineStyle)
 
void setLineType (LineType lineType)
 
void setRenderPlotLine (bool renderPlotLine)
 
void setSectionsToRender (const QVector< int > &sectionsToRender)
 
void setSourceColor (const DataSeries &series)
 
void setSourceX (const DataSeries &series)
 
void setSourceY (const DataSeries &series)
 
void setUniformColor (const QColor &color)
 

Static Public Member Functions

static QPainterPath createPath (Glyph glyph, double size)
 
static const QVector< qreal > & getDashPattern (LineStyle lineStyle)
 
static bool isFilled (Glyph glyph)
 

Detailed Description

A PlotItem object specifies a pair of DataSeries objects to be used to generate a single line, set of points, etc. to be included in a Plot. It also contains information on how the data should be presented, such as line style and color, glyphs at each data point, etc.

Member Enumeration Documentation

◆ ColorMode

enum ColorMode
Enumerator
UniformColor 
UseColorScale 

◆ Glyph

enum Glyph
Enumerator
NoGlyph 
Point 
Plus 
Cross 
Asterisk 
Circle 
CirclePlus 
CircleCross 
Square 
Diamond 
Hexagon 
TriangleUp 
TriangleDown 
TriangleLeft 
TriangleRight 
CircleFilled 
SquareFilled 
DiamondFilled 
HexagonFilled 
TriangleUpFilled 
TriangleDownFilled 
TriangleLeftFilled 
TriangleRightFilled 

◆ LineMode

enum LineMode
Enumerator
OneLineThroughAllDataPoints 
HorizontalLineThroughEachDataPoint 
VerticalLineThroughEachDataPoint 

◆ LineStyle

enum LineStyle
Enumerator
NoLine 
SolidLine 
LongDashLine 
ShortDashLine 
DotLine 
ShortDashDotLine 
LongDashDotLine 
ShortDashDotDotLine 
LongDashDotDotLine 

◆ LineType

enum LineType
Enumerator
Segment 
Step 

Constructor & Destructor Documentation

◆ PlotItem() [1/2]

PlotItem ( )

◆ PlotItem() [2/2]

PlotItem ( const PlotItem item)

◆ ~PlotItem()

~PlotItem ( )

Member Function Documentation

◆ createPath()

QPainterPath createPath ( PlotItem::Glyph  glyph,
double  size 
)
static
Parameters
glyphSpecifies the glyph for which a painter path should be built.
sizeThis is the size (ie width or height) of the glyph.
Returns
A painter path for the specified glyph.

◆ getColorMode()

PlotItem::ColorMode getColorMode ( ) const

◆ getColorScale()

const ColorScale & getColorScale ( ) const

◆ getDashPattern()

const QVector< qreal > & getDashPattern ( PlotItem::LineStyle  lineStyle)
static
Parameters
lineStyleThe line style for which the custom dash pattern is needed. It should not really be either NoLine or SolidLine.
Warning
This first call to this function is not thread-safe. Subsequent calls will be.

◆ getFitPointsToXAxisLimits()

bool getFitPointsToXAxisLimits ( ) const

◆ getFitPointsToYAxisLimits()

bool getFitPointsToYAxisLimits ( ) const

◆ getGlyph()

PlotItem::Glyph getGlyph ( ) const

◆ getIncludeInLegend()

bool getIncludeInLegend ( ) const

◆ getLabel()

const QString & getLabel ( ) const

◆ getLineMode()

PlotItem::LineMode getLineMode ( ) const

◆ getLineStyle()

PlotItem::LineStyle getLineStyle ( ) const

◆ getLineType()

PlotItem::LineType getLineType ( ) const

◆ getRenderPlotLine()

bool getRenderPlotLine ( ) const

◆ getSectionsToRender()

const QVector< int > & getSectionsToRender ( ) const

◆ getSourceColor()

const DataSeries & getSourceColor ( ) const

◆ getSourceX()

const DataSeries & getSourceX ( ) const

◆ getSourceY()

const DataSeries & getSourceY ( ) const

◆ getUniformColor()

const QColor & getUniformColor ( ) const

◆ isAntiAliasing()

bool isAntiAliasing ( ) const

◆ isEnabled()

bool isEnabled ( ) const

◆ isFilled()

bool isFilled ( PlotItem::Glyph  glyph)
static
Returns
True if the specified glyph type is a filled glyph.

◆ operator=()

PlotItem & operator= ( const PlotItem item)

◆ setAntiAliasing()

void setAntiAliasing ( bool  antiAliasing)
Parameters
antiAliasingIf set to true, then the plot item will be drawn with anti-aliasing turned on where appropriate. The default is off, since anti-aliasing can make some plots appear less crisp.

◆ setColorMode()

void setColorMode ( PlotItem::ColorMode  colorMode)
Parameters
colorModeSpecifies the color mode to use

◆ setColorScale()

void setColorScale ( const ColorScale colorScale)
Parameters
colorScaleSpecifies the color to use for the plot item. The default color is black.

◆ setEnabled()

void setEnabled ( bool  enabled)
Parameters
enabledIf this is set to true, then the plot item is allowed to appear in plots. Setting this to false is the easiest way to hide this particular plot item, since the item then doesn't have to be removed from plots and all its other properties are left untouched. Plot items are disabled by default because when created, they have no data.

◆ setFitPointsToXAxisLimits()

void setFitPointsToXAxisLimits ( bool  fit)

◆ setFitPointsToYAxisLimits()

void setFitPointsToYAxisLimits ( bool  fit)

◆ setGlyph()

void setGlyph ( PlotItem::Glyph  glyph)
Parameters
glyphSpecifies what glyph to draw at each point.

◆ setIncludeInLegend()

void setIncludeInLegend ( bool  includeInLegend)
Parameters
includeInLegendIf set to true, then this plot item will be included in any legend shown on its plot. The default is true.

◆ setLabel()

void setLabel ( const QString &  label)
Parameters
labelThe label to use for this plot item. If it is left blank, then the description associated with the Y data in the data collection will be used. Normally, the data collection can be expected to provide reasonable descriptions, so setting the label is not normally needed.

◆ setLineMode()

void setLineMode ( PlotItem::LineMode  lineMode)
Parameters
lineModeSpecifies what line mode to use for this plot item. The default is PlotItem::OneLineThroughAllDataPoints.

◆ setLineStyle()

void setLineStyle ( PlotItem::LineStyle  lineStyle)
Parameters
lineStyleSpecifies what line style to use for this plot item. The default is PlotItem::SolidLine.

◆ setLineType()

void setLineType ( PlotItem::LineType  lineType)
Parameters
lineTypeSpecifies how lines are connected to one another for line plots. The default is PlotItem::Segment, which means to join the end points of each line segment, resulting in a continuous set of lines from point to point.

◆ setRenderPlotLine()

void setRenderPlotLine ( bool  renderPlotLine)

◆ setSectionsToRender()

void setSectionsToRender ( const QVector< int > &  sectionsToRender)
Parameters
sectionsToRenderSeries of integer pairs to determine which sections of a plot line will be rendered. If this array is empty, the whole plot will be rendered. This array of ints needs to be ordered so that the plot render doesn't fall into an inifnite loop.

◆ setSourceColor()

void setSourceColor ( const DataSeries series)
Parameters
seriesThe data series to use as the source for the color data. The default is a NullDataSeries which will create a valid but empty plot (assuming the X source is compatible).
See also
getSourceColor(), setSourceColor()

◆ setSourceX()

void setSourceX ( const DataSeries series)
Parameters
seriesThe data series to use as the source for the X data. The default is a SequenceDataSeries, which will allow just the Y data to have a source and be plotted against a regularly spaced X axis.
See also
getSourceX(), setSourceY()

◆ setSourceY()

void setSourceY ( const DataSeries series)
Parameters
seriesThe data series to use as the source for the Y data. The default is a NullDataSeries which will create a valid but empty plot (assuming the X source is compatible).
See also
getSourceY(), setSourceX()

◆ setUniformColor()

void setUniformColor ( const QColor &  color)
Parameters
colorSpecifies the color to use for the plot item. The default color is black.