Plot

class CPlot

Plot in the unit.

Public Functions

std::string GetName() const

Returns the name of the plot.

Returns

Plot’s name.

void SetName(const std::string &_name)

Sets new name of the plot.

Parameters

_name – Plot’s name.

std::string GetLabelX() const

Returns a label of the X axis.

Returns

X label of the plot.

std::string GetLabelY() const

Returns a label of the Y axis.

Returns

Y label of the plot.

std::string GetLabelZ() const

Returns a label of the Z axis.

Returns

Z label of the plot.

void SetLabelX(const std::string &_label)

Sets a label of the X axis.

Parameters

_label – X label of the plot.

void SetLabelY(const std::string &_label)

Sets a label of the Y axis.

Parameters

_label – Y label of the plot.

void SetLabelZ(const std::string &_label)

Sets a label of the Z axis.

Parameters

_label – Z label of the plot.

void SetLabels(const std::string &_labelX, const std::string &_labelY)

Sets labels of all axes.

Parameters
  • _labelX – X label of the plot.

  • _labelY – Y label of the plot.

void SetLabels(const std::string &_labelX, const std::string &_labelY, const std::string &_labelZ)

Sets labels of all axes.

Parameters
  • _labelX – X label of the plot.

  • _labelY – Y label of the plot.

  • _labelZ – Z label of the plot.

CCurve *AddCurve(const std::string &_name)

Adds a new curve with the specified name to the plot.

If a curve with the given name already exists, does nothing, and returns nullptr.

Parameters

_name – Plot’s name.

Returns

Pointer to the added curve.

CCurve *AddCurve(const std::string &_name, const std::vector<double> &_x, const std::vector<double> &_y)

Adds a new curve with the specified name to the plot and fills it with the given values.

X and Y must have the same length. If a curve with the given name already exists, does nothing, and returns nullptr.

Parameters
  • _name – Plot’s name.

  • _x – X-values of the points.

  • _y – Y-values of the points.

Returns

Pointer to the added curve.

CCurve *AddCurve(const std::string &_name, const std::vector<CPoint> &_points)

Adds a new curve with the specified name to the plot and fills it with the given values.

If a curve with the given name already exists, does nothing, and returns nullptr.

Parameters
  • _name – Plot’s name.

  • _points – Points on the curve.

Returns

Pointer to the added curve.

std::vector<CCurve*> AddCurves(const std::vector<std::string> &_names)

Adds several curves with the specified names to the plot.

If any curve with the given name value already exists, does nothing, and returns empty vector.

Parameters

_names – Names of the curves.

Returns

Pointers to the added curves.

CCurve *AddCurve(double _z)

Adds a new curve with the specified Z value to the plot.

If a curve with the given Z value already exists, does nothing, and returns nullptr.

Parameters

_z – Z-value of the curve.

Returns

Pointer to the added curve.

CCurve *AddCurve(double _z, const std::vector<double> &_x, const std::vector<double> &_y)

Adds a new curve with the specified Z value to the plot and fills it with the given values.

X and Y must have the same length. If a curve with the given Z value already exists, does nothing, and returns nullptr.

Parameters
  • _z – Z-value of the curve.

  • _x – X-values of the points.

  • _y – Y-values of the points.

Returns

Pointer to the added curve.

CCurve *AddCurve(double _z, const std::vector<CPoint> &_points)

Adds a new curve with the specified Z value to the plot and fills it with the given values.

If a curve with the given Z value already exists, does nothing, and returns nullptr.

Parameters
  • _z – Z-value of the curve.

  • _points – New points.

Returns

Pointer to the added curve.

std::vector<CCurve*> AddCurves(const std::vector<double> &_z)

Adds several curves with the specified Z values to the plot.

If any curve with the given Z value already exists, does nothing, and returns empty vector.

Parameters

_z – Z-values of the curves.

Returns

Pointers to the added curves.

const CCurve *GetCurve(size_t _index) const

Returns a curve with the specified index.

Parameters

_index – Index of the curve.

Returns

Const pointer to the curve.

CCurve *GetCurve(size_t _index)

Returns a curve with the specified index.

Parameters

_index – Index of the curve.

Returns

Pointer to the curve.

const CCurve *GetCurve(const std::string &_name) const

Returns a curve with the specified name.

Parameters

_name – Name of the curve.

Returns

Const pointer to the curve.

CCurve *GetCurve(const std::string &_name)

Returns a curve with the specified name.

Parameters

_name – Name of the curve.

Returns

Pointer to the curve.

const CCurve *GetCurve(double _z) const

Returns a curve with the specified Z value.

Parameters

_z – Z-value of the curve.

Returns

Const pointer to the curve.

CCurve *GetCurve(double _z)

Returns a curve with the specified Z value.

Parameters

_z – Z-value of the curve.

Returns

Pointer to the curve.

void RemoveCurve(const std::string &_name)

Removes a curve with the specified name from the plot.

Parameters

_name – Name of the curve.

void RemoveCurve(double _z)

Removes a curve with the specified Z value from the plot.

Parameters

_z – Z-value of the curve.

std::vector<const CCurve*> GetAllCurves() const

Returns all curves defined in the plot.

Returns

Const pointers to the curves.

std::vector<CCurve*> GetAllCurves()

Returns all curves defined in the plot.

Returns

Pointers to the curves.

std::vector<double> GetZValues() const

Returns Z values of all defined curves.

Returns

Z values of the curves.

bool Is2D() const

Checks if the plot is a 2D plot, based on the presence of Z values.

Returns

Whether the curve is 2D.

size_t GetCurvesNumber() const

Returns a number of defined curves.

Returns

Number of curves.

void ClearData()

Removes all defined curves from the plot.

void Clear()

Removes all data from the plot.