add style support
This commit is contained in:
@@ -23,9 +23,15 @@
|
||||
namespace ns3 {
|
||||
|
||||
GnuplotDataset::GnuplotDataset (std::string title)
|
||||
: m_title (title)
|
||||
: m_title (title),
|
||||
m_style (LINES)
|
||||
{}
|
||||
void
|
||||
GnuplotDataset::SetStyle (enum Style style)
|
||||
{
|
||||
m_style = style;
|
||||
}
|
||||
void
|
||||
GnuplotDataset::Add (double x, double y)
|
||||
{
|
||||
m_dataset.push_back (std::make_pair (x,y));
|
||||
@@ -59,6 +65,32 @@ Gnuplot::GenerateOutput (std::ostream &os)
|
||||
for (Datasets::const_iterator i = m_datasets.begin (); i != m_datasets.end ();)
|
||||
{
|
||||
os << "'-' title '" << (*i)->m_title << "'";
|
||||
switch ((*i)->m_style) {
|
||||
case GnuplotDataset::LINES:
|
||||
os << " with lines";
|
||||
break;
|
||||
case GnuplotDataset::POINTS:
|
||||
os << " with points";
|
||||
break;
|
||||
case GnuplotDataset::LINES_POINTS:
|
||||
os << " with linespoints";
|
||||
break;
|
||||
case GnuplotDataset::DOTS:
|
||||
os << " with dots";
|
||||
break;
|
||||
case GnuplotDataset::IMPULSES:
|
||||
os << " with impulses";
|
||||
break;
|
||||
case GnuplotDataset::STEPS:
|
||||
os << " with steps";
|
||||
break;
|
||||
case GnuplotDataset::FSTEPS:
|
||||
os << " with fsteps";
|
||||
break;
|
||||
case GnuplotDataset::HISTEPS:
|
||||
os << " with histeps";
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
if (i != m_datasets.end ())
|
||||
{
|
||||
|
||||
@@ -29,13 +29,26 @@ namespace ns3 {
|
||||
class GnuplotDataset
|
||||
{
|
||||
public:
|
||||
enum Style {
|
||||
LINES,
|
||||
POINTS,
|
||||
LINES_POINTS,
|
||||
DOTS,
|
||||
IMPULSES,
|
||||
STEPS,
|
||||
FSTEPS,
|
||||
HISTEPS,
|
||||
};
|
||||
|
||||
GnuplotDataset (std::string title);
|
||||
void SetStyle (enum Style style);
|
||||
void Add (double x, double y);
|
||||
private:
|
||||
friend class Gnuplot;
|
||||
typedef std::vector<std::pair<double,double> > Dataset;
|
||||
Dataset m_dataset;
|
||||
std::string m_title;
|
||||
enum Style m_style;
|
||||
};
|
||||
|
||||
class Gnuplot
|
||||
|
||||
Reference in New Issue
Block a user