XYCurve

A description for XYCurve.

class XYCurve : public Plot

This class implements the visualization of a 2D/xy curve.

The visualization of the curve can be parametrized via various parameters and can be used to achieve the visualizations that are commonly named as line plot, scatter plot, error bar plot, line+symbol plot, rug plot, etc. or any combinations of them.

Subclassed by XYAnalysisCurve, XYEquationCurve

Public Functions

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 void save(QXmlStreamWriter*) const override

Save as XML.

virtual bool load(XmlStreamReader*, bool preview) override

Load from XML.

double y(double x, bool &valueFound) const

Find y value which corresponds to a x . valueFound indicates, if value was found. When monotonic increasing or decreasing a different algorithm will be used, which needs less steps (mean) (log_2(rowCount)) to find the value.

Parameters:
  • x

  • valueFound

Returns:

QDateTime yDateTime(double x, bool &valueFound) const

Find y DateTime which corresponds to a x . valueFound indicates, if value was found. When monotonic increasing or decreasing a different algorithm will be used, which needs less steps (mean) (log_2(rowCount)) to find the value.

Parameters:
  • x

  • valueFound

Returns:

Return found value

virtual bool hasData() const override

returns true if a valid data column is set, returns false otherwise. Used in CartesianPlot to determine whether the curve needs to be taken into account when calculating the data ranges of the plot area.

virtual bool usingColumn(const AbstractColumn*, bool indirect) const override

returns true if the column is used internally in the plot for the visualisation, returns false otherwise. If indirect is true it returns true also if a depending curve uses that column

bool isSourceDataChangedSinceLastRecalc() const

return true if the data in the source columns (x, y) used in the analysis curves, false otherwise

virtual void recalc() override

recalculates the internal structures (additional data containers, drawing primitives, etc.) on data changes in the source data columns. these structures are used in the plot during the actual drawing of the plot on geometry changes.

void enableLineOptimization(bool)

if enable is set to true, enables the line optimization to reduce the total number of lines to be drawn, disables it otherwise. On default, the line optimization is activated. Used when exporting/printing the parent worksheet to disable the line optimization to get better result.

double y(double x, double &x_new, bool &valueFound) const
Parameters:
  • x – :value for which y should be found

  • valueFound – returns true if y value found, otherwise false

  • x_new – exact x value where y value is

Returns:

y value from x value

int getNextValue(double xpos, int index, double &x, double &y, bool &valueFound) const

Find nearest x value from a value xpos and his y value

Parameters:
  • xpos – position for which the next index xpos should be found

  • offset – Offset from the index where xpos is. Positive is after the found index, negative is before the found index

  • x – x value at the found index

  • y – y value at the found index

  • valueFound – True when value found, otherwise false