mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
Plot: dashed lines
This commit is contained in:
parent
e37f2ab124
commit
cb2f6bf0aa
@ -356,6 +356,17 @@ void LineWidth::operator()(PlotOptions &option) const
|
||||
option.lineWidth = static_cast<int>(width_);
|
||||
}
|
||||
|
||||
// Dash constructor ///////////////////////////////////////////////////////////
|
||||
Dash::Dash(const string &dash)
|
||||
: dash_(dash)
|
||||
{}
|
||||
|
||||
// Dash modifier //////////////////////////////////////////////////////////////
|
||||
void Dash::operator()(PlotOptions &option) const
|
||||
{
|
||||
option.dashType = dash_;
|
||||
}
|
||||
|
||||
// LogScale constructor ////////////////////////////////////////////////////////
|
||||
LogScale::LogScale(const Axis axis)
|
||||
: axis_(axis)
|
||||
@ -470,6 +481,7 @@ void Plot::initOptions(void)
|
||||
options_.label[1] = "";
|
||||
options_.lineColor = "";
|
||||
options_.lineWidth = -1;
|
||||
options_.dashType = "";
|
||||
options_.palette = Palette::category10;
|
||||
}
|
||||
|
||||
@ -505,6 +517,11 @@ Plot & Plot::operator<<(PlotObject &&command)
|
||||
commandStr += " lw " + strFrom(options_.lineWidth);
|
||||
options_.lineWidth = -1;
|
||||
}
|
||||
if (!options_.dashType.empty())
|
||||
{
|
||||
commandStr += " dt " + options_.dashType;
|
||||
options_.dashType = "";
|
||||
}
|
||||
if (options_.title.empty())
|
||||
{
|
||||
commandStr += " notitle";
|
||||
|
@ -199,6 +199,7 @@ struct PlotOptions
|
||||
std::string label[2];
|
||||
std::string lineColor;
|
||||
int lineWidth;
|
||||
std::string dashType;
|
||||
std::vector<std::string> palette;
|
||||
};
|
||||
|
||||
@ -264,6 +265,19 @@ private:
|
||||
const unsigned width_;
|
||||
};
|
||||
|
||||
class Dash: public PlotModifier
|
||||
{
|
||||
public:
|
||||
// constructor
|
||||
explicit Dash(const std::string &dash);
|
||||
// destructor
|
||||
virtual ~Dash(void) = default;
|
||||
// modifier
|
||||
virtual void operator()(PlotOptions &option) const;
|
||||
private:
|
||||
const std::string dash_;
|
||||
};
|
||||
|
||||
class LogScale: public PlotModifier
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user