Worksheet Element Containers

This is a container for worksheet elements and has a plot area to hold plot area elements.

class CartesianPlot : public AbstractPlot

This class implements the cartesian plot and the actual plot area that is visualized on the Worksheet.

The definition of the cartesian coordinate systems as well as of the to be plotted data ranges is done in this class.

Public Functions

void setType(Type type)

initializes all children of CartesianPlot and setups a default plot of type type with a plot title.

virtual QIcon icon() const override

Returns an icon to be used in the project explorer.

virtual QMenu *createContextMenu() override

Return a new context menu.

The caller takes ownership of the menu.

virtual QVector<AbstractAspect*> dependsOn() const override

returns the list of all parent aspects (folders and sub-folders)

virtual QVector<AspectType> pasteTypes() const override

return the list of all aspect types that can be copy&pasted into the current aspect. returns an empty list on default, needs to be re-implemented in all derived classes that want to allow other aspects to be pasted into.

QRectF dataRect() const

returns the actual bounding rectangular of the plot area showing data (plot’s rectangular minus padding) in plot’s coordinates

void addLegend(CartesianPlotLegend*)

public helper function to set a legend object created outside of CartesianPlot, e.g. in OriginProjectParser.

int curveChildIndex(const WorksheetElement*) const

returns the index of the child curve in the list of all “curve-like” children (xy-curve, histogram, boxplot, etc.). This function is used when applying the theme color to the newly added “curve”.:

virtual void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

Public Slots

void shift(int index, const Dimension, bool leftOrDown)

helper function called in other shift*() functions and doing the actual change of the data ranges.

Parameters:
  • x – if set to \true the x-range is modified, the y-range for false

  • leftOrDown – the “shift left” for x or “shift dows” for y is performed if set to \true , “shift right” or “shift up” for false

void dataChanged(int xIndex = -1, int yIndex = -1, WorksheetElement *sender = nullptr)

called when in one of the curves the data was changed. Autoscales the coordinate system and the x-axes, when “auto-scale” is active.

struct RangeBreak
struct RangeBreaks