source: trunk/lib/Graph.cc @ 860

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

Now the summary plot is visible in index.html

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1// $Id: Graph.cc 860 2009-11-19 23:36:42Z 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.c_str());
33    pls_.init();
34    pls_.adv(0);
35    pls_.vsta();
36  }
37
38
39  Graph::~Graph(void)
40  {
41  }
42
43
44  bool Graph::date_xticks(void)
45  {
46    return xticks_.size() != 0;
47  }
48
49
50  void Graph::fgcolour(unsigned char r, unsigned char g, unsigned char b)
51  {
52    pls_.rgb(r,g,b);
53  }
54
55
56  void Graph::plot(const std::vector<unsigned int>& x)
57  {
58    pls_.wind(0, x.size(), 0, yrange_);
59    pls_.box("bcnstv", 10, 1, "bcnstv", yrange_/5, 1);
60    for (unsigned int i=1; i<x.size(); ++i) {
61      pls_.join(i-1,x[i-1],i-1,x[i]);
62      pls_.join(i-1,x[i],i,x[i]);
63    }
64  }
65
66
67  const std::vector<std::string>& Graph::xticks(void)
68  {
69    return xticks_;
70  }
71
72
73  double Graph::yrange(double ymax)
74  {
75    return yrange_=ymax;
76  }
77
78}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.