Changeset 863


Ignore:
Timestamp:
Nov 20, 2009, 7:21:17 PM (12 years ago)
Author:
Jari Häkkinen
Message:

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

Location:
trunk/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Graph.cc

    r860 r863  
    2828
    2929  Graph::Graph(const std::string& filename)
     30    : plots_(0), pls_(1,1,"svg",filename.c_str())
    3031  {
    31     pls_.sdev("svg");
    32     pls_.sfnam(filename.c_str());
     32    // we use colour map 0 position 0 for background colour
     33    pls_.scolbga(230,230,230,1);
    3334    pls_.init();
    3435    pls_.adv(0);
     
    4849
    4950
    50   void Graph::fgcolour(unsigned char r, unsigned char g, unsigned char b)
     51  void Graph::current_colour(unsigned char r, unsigned char g, unsigned char b)
    5152  {
    52     pls_.rgb(r,g,b);
     53    // we use colour map 0 position 1 for current colour
     54    pls_.scol0a(1,r,g,b,1.0);
     55    pls_.col0(1);
    5356  }
    5457
     
    5760  {
    5861    pls_.wind(0, x.size(), 0, yrange_);
    59     pls_.box("bcnstv", 10, 1, "bcnstv", yrange_/5, 1);
     62    if (!plots_) {
     63      // draw plot frame, x and y ticks only for the first plot
     64      pls_.scol0a(2,0,0,0,1.0);
     65      pls_.col0(2);
     66      pls_.box("bcnstv", 10, 1, "bcnstv", yrange_/5, 1);
     67      pls_.col0(1);
     68    }
     69    ++plots_;
    6070    for (unsigned int i=1; i<x.size(); ++i) {
    6171      pls_.join(i-1,x[i-1],i-1,x[i]);
  • trunk/lib/Graph.h

    r859 r863  
    3737    /**
    3838       \brief Constructor
     39
     40       \a filename to be defined depending on whether we'll support
     41       more output formats than SVG.
    3942    */
    4043    Graph(const std::string& filename);
     
    4750    static bool date_xticks(void);
    4851
    49     void fgcolour(unsigned char r, unsigned char g, unsigned char b);
    50     void plot(const std::vector<unsigned int>&);
     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);
    5161
    5262    static const std::vector<std::string>& xticks(void);
    5363
     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    */
    5472    double yrange(double ymax=0.0);
    5573
    5674  private:
     75    unsigned int plots_; // keep track of number of plots drawn
    5776    plstream pls_;
    5877    static std::vector<std::string> xticks_;
  • trunk/lib/Stats.cc

    r859 r863  
    427427//    gp->command("set key height 2");
    428428//    gp->linetitle(ss.str());
    429     gp.fgcolour(255,255,0);
     429    gp.current_colour(255,255,0);
    430430    gp.plot(x);
    431431
     
    435435//    gp->command("set key height 4");
    436436//    gp->linetitle(ss.str());
    437     gp.fgcolour(0,0,255);
     437    gp.current_colour(0,0,255);
    438438    gp.plot(x);
    439439
     
    443443//    gp->command("set key height 6");
    444444//    gp->linetitle(ss.str());
    445     gp.fgcolour(0,255,0);
     445    gp.current_colour(0,255,0);
    446446    gp.plot(x);
    447447
     
    450450//    gp->command("set key height 0");
    451451//    gp->linetitle(ss.str());
    452     gp.fgcolour(255,0,0);
     452    gp.current_colour(255,0,0);
    453453    gp.plot(total);
    454454  }
Note: See TracChangeset for help on using the changeset viewer.