XYCurve

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

Public Types

  • enum DropLineType

  • enum LineType

Public Methods

void

XYCurve(const QString &name, AspectType type=AspectType::XYCurve, bool loading=false)

Background*

background() const

QColor

color() const override

const AbstractColumn*

column(CartesianCoordinateSystem::Dimension dim) const

QMenu*

createContextMenu() override

int

dataCount(Dimension dim) const override

Line*

dropLine() const

void

enableLineOptimization(bool)

ErrorBar*

errorBar() const

int

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

void

handleResize(double horizontalRatio, double verticalRatio, bool pageResize) override

bool

hasData() const override

QIcon

icon() const override

bool

indicesMinMax(const Dimension dim, double v1, double v2, int &start, int &end) const override

bool

isSourceDataChangedSinceLastRecalc() const

Line*

line() const

bool

load(XmlStreamReader *, bool preview) override

void

loadThemeConfig(const KConfig &) override

double

maximum(CartesianCoordinateSystem::Dimension dim) const override

bool

minMax(const CartesianCoordinateSystem::Dimension dim, const Range< int > &indexRange, Range< double > &r, bool includeErrorBars=true) const override

double

minimum(CartesianCoordinateSystem::Dimension dim) const override

void

recalc() override

void

retransform() override

void

save(QXmlStreamWriter *) const override

void

saveThemeConfig(const KConfig &) override

void

setPlotType(Plot::PlotType)

QIcon

staticIcon(XYCurve::PlotType type)

Symbol*

symbol() const

void

updateLocale() override

bool

usingColumn(const AbstractColumn *, bool indirect) const override

Value*

value() const

double

y(double x, bool &valueFound) const

double

y(double x, double &x_new, bool &valueFound) const

QDateTime

yDateTime(double x, bool &valueFound) const

Detailed Description

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.

bool isSourceDataChangedSinceLastRecalc() const

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

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