From cdcfbd8ab2e014ee7957512da4bbba2f6b70f1ac Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 6 Nov 2007 15:05:47 +0100 Subject: [PATCH] add style support --- src/common/gnuplot.cc | 34 +++++++++++++++++++++++++++++++++- src/common/gnuplot.h | 13 +++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/common/gnuplot.cc b/src/common/gnuplot.cc index 4756a7176..22818bf89 100644 --- a/src/common/gnuplot.cc +++ b/src/common/gnuplot.cc @@ -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 ()) { diff --git a/src/common/gnuplot.h b/src/common/gnuplot.h index d692a62b8..f9f26cf3f 100644 --- a/src/common/gnuplot.h +++ b/src/common/gnuplot.h @@ -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 > Dataset; Dataset m_dataset; std::string m_title; + enum Style m_style; }; class Gnuplot