1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 08:55:37 +00:00

Plot: horizontal lines and axis labels

This commit is contained in:
Antonin Portelli 2015-02-13 15:26:00 +00:00
parent 80ec189b91
commit 60a010b592
2 changed files with 41 additions and 0 deletions

View File

@ -111,6 +111,12 @@ PlotData::PlotData(const XYStatData &data, const Index i, const Index j)
setCommand("'" + tmpFileName + "' " + usingCmd);
}
// PlotHLine constructor ///////////////////////////////////////////////////////
PlotHLine::PlotHLine(const double y)
{
setCommand(strFrom(y));
}
// PlotFunction constructor ////////////////////////////////////////////////////
PlotFunction::PlotFunction(const DoubleFunction &function, const double xMin,
const double xMax, const unsigned int nPoint)
@ -173,6 +179,18 @@ void Caption::operator()(PlotOptions &option) const
option.caption = caption_;
}
// Label constructor ///////////////////////////////////////////////////////////
Label::Label(const string &label, const Axis axis)
: label_(label)
, axis_(axis)
{}
// Label modifier //////////////////////////////////////////////////////////////
void Label::operator()(PlotOptions &option) const
{
option.label[static_cast<int>(axis_)] = label_;
}
// Color constructor ///////////////////////////////////////////////////////////
Color::Color(const string &color)
: color_(color)

View File

@ -81,6 +81,15 @@ public:
virtual ~PlotData(void) = default;
};
class PlotHLine: public PlotObject
{
public:
// constructor
PlotHLine(const double y);
// destructor
virtual ~PlotHLine(void) = default;
};
class PlotFunction: public PlotObject
{
public:
@ -146,6 +155,20 @@ private:
const std::string caption_;
};
class Label: public PlotModifier
{
public:
// constructor
explicit Label(const std::string &label, const Axis axis);
// destructor
virtual ~Label(void) = default;
// modifier
virtual void operator()(PlotOptions &option) const;
private:
const std::string label_;
const Axis axis_;
};
class Color: public PlotModifier
{
public: