Workspace 6.21.5
|
The plot class holds the information required to generate a 2D plot. More...
#include <DataAnalysis/Plot2D/plot.h>
Public Types | |
enum | LegendAnchor { PlotBoxTopLeft , PlotBoxTopRight } |
Specifies what anchor point the legend should be relative to. More... | |
Public Member Functions | |
Plot () | |
Plot (const Plot &) | |
~Plot () | |
void | addOverlay (ImageOverlay &overlay) |
void | addPlotItem (const PlotItem &plotItem) |
void | clear () |
QStringList | findXAxisAutoLimits (double &minimum, double &maximum) const |
QStringList | findXAxisLimits (double &minimum, double &maximum) const |
QStringList | findYAxisAutoLimits (double &minimum, double &maximum) const |
QStringList | findYAxisLimits (double &minimum, double &maximum) const |
const QFont & | getAxesLabelFont () const |
double | getAxesLineWidth () const |
double | getAxesMajorTickLength () const |
double | getAxesMinorTickLength () const |
const QFont & | getAxesTickLabelFont () const |
const QColor & | getBackgroundColor () const |
double | getDataLineWidth () const |
int | getDistBetweenLabels () const |
bool | getDynamicMarginsOveride () const |
const QColor & | getForegroundColor () const |
LegendAnchor | getLegendAnchor () const |
const QFont & | getLegendFont () const |
const QPoint & | getLegendOffset () const |
int | getLongestYLabel () const |
int | getMarginBottom () const |
int | getMarginLeft () const |
int | getMarginRight () const |
int | getMarginTop () const |
unsigned | getNumOverlays () const |
uint | getOpenGLSamples () const |
const ImageOverlay & | getOverlay (unsigned index) const |
const PlotItem & | getPlotItem (unsigned i) const |
bool | getShowLegend () const |
const QString & | getTitle () const |
const QFont & | getTitleFont () const |
bool | getUseOpenGL () const |
bool | getUseTightAutoLimitsForXAxis () const |
bool | getUseTightAutoLimitsForYAxis () const |
QRect | getViewport (const QSize &canvasSize) const |
const AxisSettings & | getXAxisSettings () const |
const AxisSettings & | getYAxisSettings () const |
unsigned | numEnabledPlotItems () const |
unsigned | numPlotItems () const |
Plot & | operator= (const Plot &) |
void | removeOverlay (ImageOverlay &overlay) |
void | setAxesLabelFont (const QFont &font) |
void | setAxesLineWidth (double w) |
void | setAxesMajorTickLength (double t) |
void | setAxesMinorTickLength (double t) |
void | setAxesTickLabelFont (const QFont &font) |
void | setBackgroundColor (const QColor &color) |
void | setDataLineWidth (double d) |
void | setDistBetweenLabels (int) |
void | setDynamicMarginsOveride (bool dynamicMarginsOveride) |
void | setForegroundColor (const QColor &color) |
void | setLegendAnchor (LegendAnchor anchor) |
void | setLegendFont (const QFont &font) |
void | setLegendOffset (const QPoint &p) |
void | setLongestYLabel (int longestYLabel) |
void | setMarginBottom (int pixels) |
void | setMarginLeft (int pixels) |
void | setMarginRight (int pixels) |
void | setMarginTop (int pixels) |
void | setOpenGLSamples (uint samples) |
void | setShowLegend (bool b) |
void | setTitle (const QString &title) |
void | setTitleFont (const QFont &font) |
void | setUseOpenGL (bool use) |
void | setUseTightAutoLimitsForXAxis (bool use) |
void | setUseTightAutoLimitsForYAxis (bool use) |
void | setXAxisSettings (const AxisSettings &axisSettings) |
void | setYAxisSettings (const AxisSettings &axisSettings) |
The Plot class acts as a container holding everything needed for some other class to generate the actual plot image. The data stored in the Plot class includes:
enum LegendAnchor |
Plot | ( | ) |
~Plot | ( | ) |
void addOverlay | ( | ImageOverlay & | overlay | ) |
overlay | The overlay to add to the plot |
Adds an image overlay to the plot which will be displayed on top of the plot data.
void addPlotItem | ( | const PlotItem & | plotItem | ) |
plotItem | The item to add to the plot. This will be copied, but note that only a pointer to the data collection within the item is copied (ie a shallow copy). Thus, while the plotItem does not have to survive after this call, the data collection it refers to must. |
void clear | ( | ) |
Removes all plot items from the plot. If you also want to reset the axes and legend to their default settings, you should assign a default constructed plot instead of calling clear().
QStringList findXAxisAutoLimits | ( | double & | minimum, |
double & | maximum | ||
) | const |
QStringList findXAxisLimits | ( | double & | minimum, |
double & | maximum | ||
) | const |
minimum | On exit, this will hold the minimum of the X axis. The value on entry will be ignored. |
maximum | On exit, this will hold the maximum of the X axis. The value on entry will be ignored. |
QStringList findYAxisAutoLimits | ( | double & | minimum, |
double & | maximum | ||
) | const |
QStringList findYAxisLimits | ( | double & | minimum, |
double & | maximum | ||
) | const |
minimum | On exit, this will hold the minimum of the Y axis. The value on entry will be ignored. |
maximum | On exit, this will hold the maximum of the Y axis. The value on entry will be ignored. |
const QFont & getAxesLabelFont | ( | ) | const |
double getAxesLineWidth | ( | ) | const |
double getAxesMajorTickLength | ( | ) | const |
double getAxesMinorTickLength | ( | ) | const |
const QFont & getAxesTickLabelFont | ( | ) | const |
const QColor & getBackgroundColor | ( | ) | const |
double getDataLineWidth | ( | ) | const |
int getDistBetweenLabels | ( | ) | const |
bool getDynamicMarginsOveride | ( | ) | const |
const QColor & getForegroundColor | ( | ) | const |
Plot::LegendAnchor getLegendAnchor | ( | ) | const |
const QFont & getLegendFont | ( | ) | const |
const QPoint & getLegendOffset | ( | ) | const |
int getLongestYLabel | ( | ) | const |
int getMarginBottom | ( | ) | const |
int getMarginLeft | ( | ) | const |
int getMarginRight | ( | ) | const |
int getMarginTop | ( | ) | const |
unsigned getNumOverlays | ( | ) | const |
uint getOpenGLSamples | ( | ) | const |
const ImageOverlay & getOverlay | ( | unsigned | index | ) | const |
index | The index of the overlay to retrieve. |
const PlotItem & getPlotItem | ( | unsigned | index | ) | const |
bool getShowLegend | ( | ) | const |
const QString & getTitle | ( | ) | const |
const QFont & getTitleFont | ( | ) | const |
bool getUseOpenGL | ( | ) | const |
bool getUseTightAutoLimitsForXAxis | ( | ) | const |
bool getUseTightAutoLimitsForYAxis | ( | ) | const |
QRect getViewport | ( | const QSize & | canvasSize | ) | const |
const AxisSettings & getXAxisSettings | ( | ) | const |
const AxisSettings & getYAxisSettings | ( | ) | const |
unsigned numEnabledPlotItems | ( | ) | const |
unsigned numPlotItems | ( | ) | const |
void removeOverlay | ( | ImageOverlay & | overlay | ) |
overlay | The overlay to remove from the plot. |
void setAxesLabelFont | ( | const QFont & | font | ) |
font | The font to use for axis labels. |
void setAxesLineWidth | ( | double | w | ) |
w | The width of lines used to draw the axes. The width of any tick marks is also based on this value, but will typically be smaller than w. |
void setAxesMajorTickLength | ( | double | t | ) |
t | The length of any major tick marks on the axes. These would normally be longer than the minor tick length. |
void setAxesMinorTickLength | ( | double | t | ) |
t | The length of any minor tick marks on the axes. These would normally be shorter than the major tick length. |
void setAxesTickLabelFont | ( | const QFont & | font | ) |
font | The font to use for axis tick labels. |
void setBackgroundColor | ( | const QColor & | color | ) |
color | The color to use for the background of the plot. Note that a fully transparent color can be useful when overlaying the plot onto something else, such as a watermark image. Otherwise, white or in some cases black backgrounds are recommended. The default is white, since the default line color for plot items is black. |
void setDataLineWidth | ( | double | d | ) |
d | The line width for the plotted data. |
void setDistBetweenLabels | ( | int | distBetweenLabels | ) |
distBetweenLabels | Number of pixels that will seperate labels |
void setDynamicMarginsOveride | ( | bool | dynamicMarginsOveride | ) |
dynamicMarginsOveride | Flag to overide margins to make room for plot labels |
void setForegroundColor | ( | const QColor & | color | ) |
color | The color to use for the axes and title of the plot. The foreground color applies to all axis labels, lines and tick marks. The default is black. |
void setLegendAnchor | ( | Plot::LegendAnchor | anchor | ) |
anchor | The anchor point for the legend. The legend offset will be relative to this anchor point. |
void setLegendFont | ( | const QFont & | font | ) |
font | The font to use for the labels in the legend. The labels will use the plot's foreground color whereas the lines and glyphs will use each item's color. |
void setLegendOffset | ( | const QPoint & | p | ) |
p | The offset from the legend's anchor point at which the legend should be drawn. This will be the top-left of the invisible box around the legend. |
void setLongestYLabel | ( | int | longestYLabel | ) |
longestYLabel | Width of the longest tick label of Y-axis |
void setMarginBottom | ( | int | pixels | ) |
void setMarginLeft | ( | int | pixels | ) |
void setMarginRight | ( | int | pixels | ) |
void setMarginTop | ( | int | pixels | ) |
void setOpenGLSamples | ( | uint | samples | ) |
void setShowLegend | ( | bool | b | ) |
b | If set to true, the legend will be shown. |
void setTitle | ( | const QString & | title | ) |
title | The new title for the plot. |
void setTitleFont | ( | const QFont & | font | ) |
font | The font to use for the plot title. |
void setUseOpenGL | ( | bool | use | ) |
void setUseTightAutoLimitsForXAxis | ( | bool | use | ) |
void setUseTightAutoLimitsForYAxis | ( | bool | use | ) |
void setXAxisSettings | ( | const AxisSettings & | settings | ) |
settings | The axis-specific settings to use for the X axis. |
void setYAxisSettings | ( | const AxisSettings & | settings | ) |
settings | The axis-specific settings to use for the Y axis. |