Changeset 858


Ignore:
Timestamp:
Nov 19, 2009, 8:45:31 PM (11 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
Files:
5 deleted
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/README

    r806 r858  
    4343   consequence, the dependency is inherited by svndigest.
    4444
    45  * Gnuplot.
     45 * PLplot, http://plplot.sourceforge.net, and pkg-config utility,
     46   http://pkg-config.freedesktop.org, to query infomration about
     47   PLplot headers and libs.
    4648
    4749 * A standard C++ compliant compiler with one extension: svndigest
     
    114116{{{
    115117Copyright (C) 2005, 2006 Jari Häkkinen
    116 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    117 Copyright (C) 2009 Peter Johansson
     118Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
    118119
    119120This file is part of svndigest, http://dev.thep.lu.se/svndigest
  • trunk/bin/Makefile.am

    r847 r858  
    3030LDADD = $(top_builddir)/lib/libsvndigest.a \
    3131  $(top_builddir)/lib/yat/libyat.a $(SVNDIGEST_LIBS)
    32 AM_LDFLAGS = $(SVNDIGEST_LDFLAGS)
     32AM_LDFLAGS = $(SVNDIGEST_LDFLAGS) $(PLPLOT_LDFLAGS)
    3333
    3434AM_CPPFLAGS = -I$(top_srcdir)/lib $(SVNDIGEST_CPPFLAGS)
  • trunk/bin/svndigest.cc

    r847 r858  
    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());
  • trunk/configure.ac

    r847 r858  
    8282AC_PATH_PROG([HELP2MAN], [help2man], [no])
    8383AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN != xno])
    84 AC_PATH_PROG([GNUPLOT],[gnuplot],[no])
    85 AC_DEFINE_UNQUOTED([GNUPLOT_PATH], ["$GNUPLOT"],
    86                    [defined to gnuplot path (or no if gnuplot was not found)])
     84PKG_PROG_PKG_CONFIG([0.23]) # look for pkg-config
    8785
    8886# Save FLAGS
     
    178176# check if svnversion is installed
    179177AC_PATH_PROG([SVNVERSION], [svnversion], [no])
     178
     179# PLplot API checks
     180plplot_found="yes"
     181plplot_version=5.9
     182AC_CHECK_HEADER([plplot/plstream.h],
     183                [if $PKG_CONFIG --atleast-version=$plplot_version plplotd-c++; then
     184                  PLPLOT_LDFLAGS=`$PKG_CONFIG --libs plplotd-c++`
     185                  AC_SUBST([PLPLOT_LDFLAGS])
     186                else
     187                  plplot_found="nolib"
     188                fi],
     189                plplot_found="noheader")
    180190
    181191# checking if we build in a subversion WC
     
    268278fi
    269279
     280# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
     281if (test "$plplot_found" = "noheader") ; then
     282  AC_MSG_WARN([PLplot developer files cannot be found. Make sure PLplot
     283  is installed.])
     284  all_reqs_ok="false"
     285elif (test "$plplot_found" = "nolib") ; then
     286  AC_MSG_WARN([PLplot developer files found but not required API version.
     287  Version at least $plplot_version is required. Please upgrade PLplot.])
     288  all_reqs_ok="false"
     289fi
     290
    270291if test $ac_cv_type_long_long_int != yes ; then
    271292  AC_MSG_WARN([Compiler $CXX does not support `long long'.
     
    294315AC_MSG_NOTICE([    Linker flags:       $SD_LDFLAGS $LDFLAGS])
    295316AC_MSG_NOTICE([    LIBS:               $SD_LIBS $LIBS])
     317AC_MSG_NOTICE([    PLPLOT_LDFLAGS:     $PLPLOT_LDFLAGS])
    296318AC_MSG_NOTICE([   +++++++++++++++++++++++++++++++++++++++++++++++])
    297319AC_MSG_NOTICE([])
    298320
    299 # Failure to locate gnuplot is not considered fatal
    300 if (test "x$GNUPLOT" = "xno") ; then
    301   AC_MSG_WARN([Gnuplot was not found. svndigest will compile
    302   without gnuplot but will throw an exception at run-time. Please
    303   install gnuplot (available for a wide range of operating systems
    304   at http://www.gnuplot.info).])
    305   AC_MSG_NOTICE([])
    306 fi
    307 
    308321AC_MSG_NOTICE([Now type 'make && make check'.])
  • 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";
  • trunk/test/Makefile.am

    r847 r858  
    33## $Id$
    44
    5 # Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6 # Copyright (C) 2009 Peter Johansson
     5# Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
    76#
    87# This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    2423
    2524check_PROGRAMS = cache_partial_test \
    26   config_test copyright_test date_test gnuplot_pipe_test \
     25  config_test copyright_test date_test \
    2726  parser_test stats_test trac_test utility_test
    2827
     
    4140  $(top_builddir)/lib/yat/libyat.a \
    4241  $(SVNDIGEST_LIBS)
    43 AM_LDFLAGS = $(SVNDIGEST_LDFLAGS)
     42AM_LDFLAGS = $(SVNDIGEST_LDFLAGS) $(PLPLOT_LDFLAGS)
    4443
    4544AM_CPPFLAGS = -I$(top_srcdir)/lib $(SVNDIGEST_CPPFLAGS)
     
    5251copyright_test_SOURCES = copyright_test.cc
    5352date_test_SOURCES = date_test.cc
    54 gnuplot_pipe_test_SOURCES = gnuplot_pipe_test.cc
    5553parser_test_SOURCES = parser_test.cc
    5654stats_test_SOURCES = stats_test.cc
Note: See TracChangeset for help on using the changeset viewer.