Changeset 858 for trunk/lib


Ignore:
Timestamp:
Nov 19, 2009, 8:45:31 PM (12 years ago)
Author:
Jari Häkkinen
Message:

Addresses #97. Merging non-gnuplot plot generation code. Gnuplot traces left and lot of work before publication quality plots are generated.

Location:
trunk/lib
Files:
4 deleted
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/lib/File.cc

    r847 r858  
    22
    33/*
    4   Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009 Peter Johansson
     4  Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
    65
    76  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    2625#include "Configuration.h"
    2726#include "Date.h"
    28 #include "GnuplotFE.h"
     27#include "Graph.h"
    2928#include "html_utility.h"
    3029#include "HtmlStream.h"
     
    258257    int first=0;
    259258    bool using_dates=true;
    260     if (GnuplotFE::instance()->dates().empty()){
     259    if (!Graph::date_xticks()) {
    261260      using_dates=false;
    262261      last = stats_["classic"].revision();
    263262    }
    264263    else {
    265       last = Date(GnuplotFE::instance()->dates().back()).seconds();
     264      last = Date(Graph::xticks().back()).seconds();
    266265      // earliest date corresponds either to revision 0 or revision 1
    267       first = std::min(Date(GnuplotFE::instance()->dates()[0]).seconds(),
    268                        Date(GnuplotFE::instance()->dates()[1]).seconds());
     266      first = std::min(Date(Graph::xticks()[0]).seconds(),
     267                       Date(Graph::xticks()[1]).seconds());
    269268    }
    270269    // color is calculated linearly on time, c = kt + m
  • trunk/lib/Makefile.am

    r847 r858  
    44
    55# Copyright (C) 2005 Jari Häkkinen
    6 # Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    7 # Copyright (C) 2009 Peter Johansson
     6# Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
    87#
    98# This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    3534  Commitment.h Configuration.h copyright_year.h css.h\
    3635  Date.h Directory.h File.h first_page.h Functor.h \
    37   Gnuplot.h GnuplotFE.h \
     36  Graph.h \
    3837  HtmlBuf.h HtmlStream.h html_utility.h LineTypeParser.h \
    3938  Node.h
     
    4645  Commitment.cc Configuration.cc copyright_year.cc \
    4746  css.cc Date.cc Directory.cc File.cc first_page.cc\
    48   Functor.cc Gnuplot.cc GnuplotFE.cc  HtmlBuf.cc HtmlStream.cc \
     47  Functor.cc Graph.cc HtmlBuf.cc HtmlStream.cc \
    4948  html_utility.cc LineTypeParser.cc Node.cc \
    5049  OptionVersion.cc \
  • trunk/lib/Stats.cc

    r847 r858  
    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
  • trunk/lib/Stats.h

    r847 r858  
    191191                 Author2Vector& map);
    192192
    193     ///
    194     /// Init statistics graph.
    195     ///
    196     void plot_init(const std::string& output) const;
    197 
    198193    std::set<std::string> authors_;
    199194
  • trunk/lib/first_page.cc

    r847 r858  
    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.