Changeset 855


Ignore:
Timestamp:
Nov 19, 2009, 2:56:28 PM (14 years ago)
Author:
Jari Häkkinen
Message:

Addresses #97. One summary plot is generated with plplot ... much more to do.

Location:
branches/replacing_gnuplot
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/replacing_gnuplot/bin/Makefile.am

    r845 r855  
    3131LDADD = $(top_builddir)/lib/libsvndigest.a \
    3232  $(top_builddir)/lib/yat/libyat.a $(SVNDIGEST_LIBS)
    33 AM_LDFLAGS = $(SVNDIGEST_LDFLAGS)
     33AM_LDFLAGS = $(SVNDIGEST_LDFLAGS) $(PLPLOT_LDFLAGS)
    3434
    3535AM_CPPFLAGS = -I$(top_srcdir)/lib $(SVNDIGEST_CPPFLAGS)
  • branches/replacing_gnuplot/bin/svndigest.cc

    r845 r855  
    2727#include "Directory.h"
    2828#include "first_page.h"
    29 #include "GnuplotFE.h"
    3029#include "html_utility.h"
    3130#include "rmdirhier.h"
     
    179178        dates.push_back(iter->date());
    180179      }
    181       GnuplotFE::instance()->set_dates(dates);
     180//      GnuplotFE::instance()->set_dates(dates);
    182181    }
    183182    if (chdir(option->targetdir().c_str()) ) {
     
    190189      exit(-1);
    191190    }
    192     GnuplotFE::instance()->command(std::string("cd '")+option->targetdir()+"/"
    193                                    +tree->name()+"'");
     191//    GnuplotFE::instance()->command(std::string("cd '")+option->targetdir()+"/"
     192//                                   +tree->name()+"'");
    194193    print_css("svndigest.css");
    195194    print_main_page(tree->name(), tree->log(), stats, tree->url());
  • branches/replacing_gnuplot/lib/Graph.cc

    r788 r855  
    2525namespace svndigest {
    2626
    27   Graph::Graph(void)
     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)
    2841  {
    2942  }
    3043
     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
    3172}} // end of namespace svndigest and namespace theplu
  • branches/replacing_gnuplot/lib/Graph.h

    r789 r855  
    2626#include <vector>
    2727
     28#include <plplot/plstream.h>
     29
    2830namespace theplu {
    2931namespace svndigest {
     
    3638       \brief Constructor
    3739    */
    38     Graph(void);
     40    Graph(const std::string& filename);
     41
     42    /**
     43       \brief Destructor
     44    */
     45    ~Graph(void);
    3946
    4047    static bool date_xticks(void);
     48
     49    void plot(const std::vector<unsigned int>&);
     50
    4151    static const std::vector<std::string>& xticks(void);
     52
     53    double yrange(double ymax=0.0);
     54
     55  private:
     56    plstream pls_;
     57    static std::vector<std::string> xticks_;
    4258  };
    4359
  • branches/replacing_gnuplot/lib/Stats.cc

    r845 r855  
    2525
    2626#include "Functor.h"
    27 #include "GnuplotFE.h"
     27#include "Graph.h"
    2828#include "SVNblame.h"
    2929#include "SVNinfo.h"
     
    352352                          const std::string& linetype) const
    353353  {
     354    return filename;
    354355    assert(total_stats().size());
    355     plot_init(filename);
    356     GnuplotFE* gp=GnuplotFE::instance();
     356    Graph gp(filename);
    357357    const Author2Vector* stat=NULL;
    358358    if (linetype=="total")
     
    369369    std::vector<unsigned int> total=get_vector(*stat, "all");   
    370370    double yrange_max=1.03*total.back()+1;
    371     gp->yrange(yrange_max);
     371    gp.yrange(yrange_max);
    372372
    373373    typedef std::vector<std::pair<std::string, std::vector<unsigned int> > > vec_type;
     
    393393      ss.str("");
    394394      ss << "set key height " << 2*plotno;
    395       gp->command(ss.str());
     395//      gp->command(ss.str());
    396396      ss.str("");
    397397      ss << get_back(*stat, i->first) << " " << i->first;
    398       gp->yrange(yrange_max);
    399       gp->linetitle(ss.str());
     398      gp.yrange(yrange_max);
     399//      gp->linetitle(ss.str());
    400400      ss.str("");
    401401      ss << "steps " << --plotno+2;
    402       gp->linestyle(ss.str());
    403       gp->plot(i->second);
     402//      gp->linestyle(ss.str());
     403//      gp->plot(i->second);
    404404    }
    405405    ss.str("");
    406406    ss << get_back(*stat, "all") << " total";
    407     gp->command("set key height 0");
    408     gp->linetitle(ss.str());
    409     gp->linestyle("steps 1");
    410     gp->plot(total);
    411 
    412     gp->command("unset multiplot");
    413     gp->yrange();
     407//    gp->command("set key height 0");
     408//    gp->linetitle(ss.str());
     409//    gp->linestyle("steps 1");
     410//    gp->plot(total);
     411
     412//    gp->command("unset multiplot");
    414413
    415414    return filename;
     
    417416
    418417
    419   void Stats::plot_init(const std::string& filename) const
    420   {
    421     GnuplotFE* gp=GnuplotFE::instance();
    422     gp->command("set term png");
    423     gp->command("set output '"+filename+"'");
    424     gp->command("set xtics nomirror");
    425     gp->command("set ytics nomirror");
    426     gp->command("set key default");
    427     gp->command("set key left Left reverse");
    428     gp->command("set multiplot");
    429   }
    430 
    431 
    432418  void Stats::plot_summary(const std::string& filename) const
    433419  {
    434     plot_init(filename);
    435     GnuplotFE* gp=GnuplotFE::instance();
     420    Graph gp(filename);
    436421    std::vector<unsigned int> total = get_vector(total_stats(), "all");
    437422    double yrange_max=1.03*total.back()+1;
    438     gp->yrange(yrange_max);
     423    gp.yrange(yrange_max);
    439424    std::stringstream ss;
    440425   
     
    442427    std::vector<unsigned int> x(get_vector(code_stats(), "all"));
    443428    ss << x.back() << " code";
    444     gp->command("set key height 2");
    445     gp->linetitle(ss.str());
    446     gp->linestyle("steps 2");
    447     gp->plot(x);
     429//    gp->command("set key height 2");
     430//    gp->linetitle(ss.str());
     431//    gp->linestyle("steps 2");
     432//    gp->plot(x);
    448433
    449434    ss.str("");
    450435    x = get_vector(comment_or_copy_stats(), "all");
    451436    ss << x.back() << " comment";
    452     gp->command("set key height 4");
    453     gp->linetitle(ss.str());
    454     gp->linestyle("steps 3");
    455     gp->plot(x);
     437//    gp->command("set key height 4");
     438//    gp->linetitle(ss.str());
     439//    gp->linestyle("steps 3");
     440//    gp->plot(x);
    456441
    457442    ss.str("");
    458443    x = get_vector(other_stats(), "all");
    459444    ss << x.back() << " other";
    460     gp->command("set key height 6");
    461     gp->linetitle(ss.str());
    462     gp->linestyle("steps 4");
    463     gp->plot(x);
     445//    gp->command("set key height 6");
     446//    gp->linetitle(ss.str());
     447//    gp->linestyle("steps 4");
     448//    gp->plot(x);
    464449
    465450    ss.str("");
    466451    ss << total.back() << " total";
    467     gp->command("set key height 0");
    468     gp->linetitle(ss.str());
    469     gp->linestyle("steps 1");
    470     gp->plot(total);
    471 
    472     gp->command("unset multiplot");
    473     gp->yrange();
     452//    gp->command("set key height 0");
     453//    gp->linetitle(ss.str());
     454//    gp->linestyle("steps 1");
     455    gp.plot(total);
     456
     457//    gp->command("unset multiplot");
    474458  }
    475459
  • branches/replacing_gnuplot/lib/Stats.h

    r784 r855  
    192192                 Author2Vector& map);
    193193
    194     ///
    195     /// Init statistics graph.
    196     ///
    197     void plot_init(const std::string& output) const;
    198 
    199194    std::set<std::string> authors_;
    200195
  • branches/replacing_gnuplot/lib/first_page.cc

    r784 r855  
    226226  void print_summary_plot(std::ostream& os, const Stats& stats)
    227227  {
    228     std::string name("summary_plot.png");
     228    std::string name("summary_plot");
    229229    stats.plot_summary(name);
    230230    os << "<div class=\"main\">\n";
Note: See TracChangeset for help on using the changeset viewer.