source: trunk/lib/Graph.cc @ 858

Last change on this file since 858 was 858, checked in by Jari Häkkinen, 12 years ago

Addresses #97. Merging non-gnuplot plot generation code. Gnuplot traces left and lot of work before publication quality plots are generated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1// $Id: Graph.cc 858 2009-11-19 19:45:31Z jari $
2
3/*
4  Copyright (C) 2009 Jari Häkkinen
5
6  This file is part of svndigest, http://dev.thep.lu.se/svndigest
7
8  svndigest is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12
13  svndigest is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "Graph.h"
23
24namespace theplu {
25namespace svndigest {
26
27  std::vector<std::string> Graph::xticks_;
28
29  Graph::Graph(const std::string& filename)
30  {
31    pls_.sdev("svg");
32    pls_.sfnam((filename+".svg").c_str());
33    pls_.init();
34    pls_.adv(0);
35    pls_.scolbg(0,100,0);
36    pls_.rgb(255,0,0);
37    pls_.vsta();
38  }
39
40  Graph::~Graph(void)
41  {
42  }
43
44  bool Graph::date_xticks(void)
45  {
46    return xticks_.size() != 0;
47  }
48
49
50  void Graph::plot(const std::vector<unsigned int>& x)
51  {
52    pls_.wind(0, x.size(), 0, x.back());
53    pls_.box("bcnstd", 100, 5, "bcnstv", 100, 5);
54    for (unsigned int i=1; i<x.size(); ++i) {
55      pls_.join(i-1,x[i-1],i-1,x[i]);
56      pls_.join(i-1,x[i],i,x[i]);
57    }
58  }
59
60
61  const std::vector<std::string>& Graph::xticks(void)
62  {
63    return xticks_;
64  }
65
66
67  double Graph::yrange(double ymax)
68  {
69    return ymax;
70  }
71
72}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.