source: trunk/lib/Graph.h @ 863

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

Addresses #97. Fixed background, added doxygen and other comments.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1#ifndef _theplu_svndigest_graph_
2#define _theplu_svndigest_graph_
3
4// $Id: Graph.h 863 2009-11-20 18:21:17Z jari $
5
6/*
7  Copyright (C) 2009 Jari Häkkinen
8
9  This file is part of svndigest, http://dev.thep.lu.se/svndigest
10
11  svndigest is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation; either version 3 of the License, or
14  (at your option) any later version.
15
16  svndigest is distributed in the hope that it will be useful, but
17  WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <string>
26#include <vector>
27
28#include <plplot/plstream.h>
29
30namespace theplu {
31namespace svndigest {
32
33  class Graph
34  {
35  public:
36
37    /**
38       \brief Constructor
39
40       \a filename to be defined depending on whether we'll support
41       more output formats than SVG.
42    */
43    Graph(const std::string& filename);
44
45    /**
46       \brief Destructor
47    */
48    ~Graph(void);
49
50    static bool date_xticks(void);
51
52    /**
53       \brief Set the pen colour to use in next drawing call
54    */
55    void current_colour(unsigned char r, unsigned char g, unsigned char b);
56
57    /**
58       \brief Plot \a data
59    */
60    void plot(const std::vector<unsigned int>& data);
61
62    static const std::vector<std::string>& xticks(void);
63
64    /**
65       \brief Set max y value in the plot
66
67       The plot area is (xstart,0) to (xend,\a ymax) where xend is
68       either the length of vector to plot (corresponds to latest
69       revision number) or the date of the last revision commit,
70       xstart is 0 or the date of the first commit.
71    */
72    double yrange(double ymax=0.0);
73
74  private:
75    unsigned int plots_; // keep track of number of plots drawn
76    plstream pls_;
77    static std::vector<std::string> xticks_;
78    double yrange_;
79  };
80
81}} // end of namespace svndigest and namespace theplu
82
83#endif
Note: See TracBrowser for help on using the repository browser.