Changeset 34 for trunk/lib/Stats.cc
- Timestamp:
- Jan 12, 2006, 2:17:11 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Stats.cc
r23 r34 3 3 #include "Stats.h" 4 4 #include "utility.h" 5 6 #include <cstdio> 7 #include <fstream> 5 8 6 9 #include <map> … … 15 18 namespace svnstat{ 16 19 17 Stats::Stats() 18 { 19 } 20 20 Gnuplot Stats::gnuplot_pipe_; 21 21 22 22 std::vector<u_int> Stats::accumulated(void) const … … 53 53 vec.resize(rev+1); 54 54 for (; i<rev; i++) 55 vec[i]=0;55 vec[i]=0; 56 56 vec[rev]=1; 57 57 } … … 61 61 62 62 } 63 64 std::string Stats::plot(void) const 65 { 66 char name[]="svnstatXXXXXX"; 67 if (mkstemp(name) == -1) { 68 std::cerr << "Failed to get unique filename: " << name << std::endl; 69 exit(-1); 70 } 71 // Jari, temporary empty files are created that needs to be removed. 72 std::string cmd=std::string("set term png; set output '")+name+".png'"; 73 gnuplot_pipe_.command(cmd); 74 cmd="plot sin(x) t 'ddd' w lines"; 75 gnuplot_pipe_.command(cmd); 76 return std::string(name)+".png"; 77 } 63 78 64 79 void Stats::print(std::ostream& os) const … … 79 94 os << "</table>\n"; 80 95 81 os << "<p> [Plot to be here.]</p>\n";96 os << "<p><img src='" << plot() << "' alt='[svnstat plot]' border=0></p>\n"; 82 97 } 83 98
Note: See TracChangeset
for help on using the changeset viewer.