13#ifndef ML_CURVE_DATA_H
14#define ML_CURVE_DATA_H
Base object class representing a single curve object, consisting of zero or one X- and any number of ...
void setYRange(double yMin, double yMax)
Explicitly set Y value range to yMin ... yMax.
double getXMin()
Get minimum X data value.
void clearData()
Clear curve data.
double getYMax()
Get maximum Y data value.
MLssize_t getPoints()
Get number of data points (i.e. minimum length of all X- and Y-series)
CurveSeries _xData
X series data.
bool _autoXRange
Flag for automatic X value ranges.
void setId(MLssize_t id)
Set (numeric) id.
std::string _title
Curve title.
int getCurveStyle() const
Get curve style (= index into a style palette used for drawing)
ML_SET_ADDSTATE_VERSION(1)
void setYValue(double value, MLssize_t iPoint)
Set Y value at index iPoint in first Y series to value (ignored if index is out of range).
std::vector< CurveSeries > _yData
Y series data.
bool _autoYRange
Flag for automatic Y value ranges.
bool _validXRange
Flag indicating up-to-date X range values.
int _curveType
Curve type (equal to one of the cty* curve type constants)
void updateXRange()
Update automatically generated X range.
double getYValue(MLssize_t iSeries, MLssize_t iPoint)
Get Y value at index iPoint in iSeries-th Y series, 0 if out of range.
void setCurveType(int type)
Set curve type (use cty* curve type constants)
CurveData * deepCopy() const override
Create a deep copy of the CurveDate.
void setY(MLssize_t nPoints, const double *data, MLssize_t step=1)
Set Y data to a single series of nPoints double values copied from the source array data.
void readStateFromTree(TreeNode *) override
Reads the object state from the children of the given parent node.
void setX(MLssize_t nPoints, const float *data, MLssize_t step=1)
void clear()
Clear curve data and reset curve properties.
void setAutoXRange()
Set X value range to 'automatic', i.e. dependent on X series data.
std::string getUnit() const
Get curve unit.
double getYMin()
Get minimum Y data value.
void setXValue(double value, MLssize_t iPoint)
Set X-series value at index iPoint to value (ignored if index is out of range).
void resizeX(MLssize_t nPoints)
Change length of X-series. New values are initialized to zero.
void setXRange(double xMin, double xMax)
Explicitly set X value range to xMin ... xMax.
MLssize_t getId() const
Get numeric id.
int getCurveType() const
Get curve type (equal to one of the cty* curve type constants)
void addStateToTree(TreeNode *) const override
Attaches the object state as children of the given parent node.
void setY(MLssize_t iSeries, MLssize_t nPoints, const float *data, MLssize_t step=1)
double getXMax()
Get maximum X data value.
void setX(MLssize_t nPoints=0, const double *data=nullptr, MLssize_t step=1)
Set X-series to nPoints double values copied from the source array data.
@ ctyLineDeltaArea
Line and shaded area between two lines, represented by a triple of Y-series.
@ ctyDeltaArea
Shaded area between two lines, represented by a pair of Y-series.
@ ctyArea
Shaded area under/above single line.
@ ctyLine
Single line, represented by a single Y-series.
double getXValue(MLssize_t iPoint)
Get X-value at index iPoint, return 0 if index is out of range.
void setXChanged()
Invalidate automatic X series properties.
void setY(MLssize_t iSeries, MLssize_t nPoints, const double *data, MLssize_t step=1)
Set the iSeries-th Y-series to nPoints double values copied from the source array data.
bool _validYRange
Flag indicating up-to-date Y range values.
bool isAutoX() const
Return true if X data is generated automatically (numbered 0, 1, ...)
void setAutoYRange()
Set Y value range to 'automatic', i.e. dependent on Y series data.
CurveData(const CurveData &curveData)
Copy constructor, series data is copied.
int _curveStyle
Curve style (= index into a style palette used for drawing)
void resizeY(MLssize_t iSeries, MLssize_t nPoints)
Change length of iSeries-th Y-series. New values are initialized to zero.
std::string getSymbol() const
Get curve symbol.
CurveData()
Default constructor.
friend bool operator==(const CurveData &x, const CurveData &y)
void setY(MLssize_t nPoints, const float *data, MLssize_t step=1)
void updateYRange()
Update automatically generated Y range.
void setYValue(double value, MLssize_t iSeries, MLssize_t iPoint)
Set Y value at index iPoint in iSeries-th Y series to value (ignored if indices are out of range).
void updateAutoX()
Update automatically generated X data.
void getXYRange(double *xMin, double *xMax, double *yMin, double *yMax)
Get X and Y value ranges (NULL pointers are allowed)
double getYValue(MLssize_t iPoint)
Get Y value at index iPoint in first Y series, 0 if out of range.
void setSymbol(std::string symbol)
Set curve symbol.
void setUnit(std::string unit)
Set curve unit.
friend bool operator!=(const CurveData &x, const CurveData &y)
void setSeries(CurveSeries &v, MLssize_t nPoints, const double *data, MLssize_t step)
Set series data (double)
std::string _symbol
Curve symbol.
void setSeries(CurveSeries &v, MLssize_t nPoints, const float *data, MLssize_t step)
Set series data (float)
void setTitle(std::string title)
Set curve title.
~CurveData() override=default
Destructor shouldn't be called directly anymore, always use the CurveDataPtr smart-pointer.
MLssize_t getNumSeries()
Get number of Y-series.
void resizeY(MLssize_t nPoints)
Change length of first Y-series. New values are initialized to zero.
void setYChanged()
Invalidate automatic Y series properties.
std::string _unit
Curve unit.
bool _autoX
Flag for automatically generated X data.
void setCurveStyle(int style)
Set curve style (= index into a style palette used for drawing)
std::string getTitle() const
Get curve title.
RefCountedBase class adds intrusive reference counting support to the Base class.
The class TreeNode is the abstract base class for the import/export of ML objects.
#define MLBASEEXPORT
defined Header file mlBaseInit.h
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define ML_REFCOUNTED_PTR(CLASSNAME)
Macro that defines convenience Ptr/ConstPtr typedefs to be used instead of intrusive_ptr templates.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
SSIZE_T MLssize_t
The signed ML size type which is a signed 32 bit size_t on 32 bit platforms and 64 bit one on 64 bit ...
std::vector< double > CurveSeries
Type definition of a standard vector of single series of X- or Y-values.