Changeset 73 for trunk/lib/Gnuplot.cc


Ignore:
Timestamp:
Mar 4, 2006, 7:10:07 PM (17 years ago)
Author:
Jari Häkkinen
Message:

Divided Gnuplot class into a basic gnuplot communication class
and a front end class specialized for svnstat.
Added option to plot stats against time or revision.
Removed gnuplot usage of temporary files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Gnuplot.cc

    r71 r73  
    66#include <string>
    77#include <unistd.h>
     8
     9#include <iostream>
    810
    911
     
    2931    if (pclose(pipe_) == -1)
    3032      throw GnuplotException("Problem closing communication to gnuplot");
    31     for (std::list<std::string>::iterator i=tempfiles_.begin();
    32          i!=tempfiles_.end(); i++)
    33       remove(i->c_str());
    3433  }
    3534
     
    5756
    5857 
    59   void Gnuplot::date_plot(const std::vector<double>& y,
    60                           const std::string& format)
    61   {
    62     command(std::string("set xdata time"));
    63     command("set timefmt '" + date_input_format_ + "'");
    64     command("set format x '" + format + "'");
    65     plot(y,date_,"plot");
    66   }
    67 
    68 
    69   void Gnuplot::date_replot(const std::vector<double>& y,
    70                             const std::string& format)
    71   {
    72     plot(y,date_,"replot");
    73   }
    74 
    75 
    7658  void Gnuplot::tokenizer(const std::string& in,
    7759                          std::list<std::string>& tokens,
     
    8870
    8971
    90   void Gnuplot::command(std::string cmdstr)
     72  void Gnuplot::command(const std::string& cmdstr)
    9173  {
     74    fputs(cmdstr.c_str(),pipe_);
    9275    if (*(cmdstr.rbegin())!='\n')
    93       cmdstr+='\n';
    94     fputs(cmdstr.c_str(),pipe_);
     76      fputc('\n',pipe_);
    9577    fflush(pipe_);
    9678  }
Note: See TracChangeset for help on using the changeset viewer.