source: trunk/lib/GnuplotFE.cc @ 74

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

Improved web presentation. Y axises normalized, ticket ticket:15 resolved.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1010 bytes
RevLine 
[73]1// $Id: GnuplotFE.cc 74 2006-03-07 15:46:59Z jari $
2
3#include "GnuplotFE.h"
4#include "Gnuplot.h"
5
6#include <string>
[74]7#include <sstream>
[73]8
9
10namespace theplu {
11namespace svnstat {
12
13
14  GnuplotFE* GnuplotFE::instance_=NULL;
15
16
[74]17  void GnuplotFE::plot(const std::vector<u_int>& y, const std::string& format)
[73]18  {
19    if (!date_.empty()) {
20      command(std::string("set xdata time"));
21      command("set timefmt '" + date_input_format_ + "'");
22      command("set format x '" + format + "'");
23      Gnuplot::plot(y,date_);
24      command(std::string("set xdata"));
25    }
26    else
27      Gnuplot::plot(y);
28  }
29
30
[74]31  void GnuplotFE::replot(const std::vector<u_int>& y)
[73]32  {
33    if (!date_.empty()) {
34      command(std::string("set xdata time"));
35      Gnuplot::replot(y,date_);
36      command(std::string("set xdata"));
37    }
38    else
39      Gnuplot::replot(y);
40  }
41
42
[74]43  double GnuplotFE::yrange(double ymax)
44  {
45    if (ymax<0)
46      ymax=0;
47    std::ostringstream cmd;
48    cmd << "set yrang[0:";
49    if (ymax)
50      cmd << ymax;
51    cmd << "]";
52
53    command(cmd.str());
54    return ymax;
55  }
56
57
[73]58}} // end of namespace svnstat and namespace theplu
Note: See TracBrowser for help on using the repository browser.