Changeset 371 for trunk/lib/Stats.cc
- Timestamp:
- Jun 19, 2007, 8:54:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Stats.cc
r361 r371 187 187 double yrange_max=1.03*total.back()+1; 188 188 gp->yrange(yrange_max); 189 size_t plotno=1; 189 190 191 typedef std::vector<std::pair<std::string, std::vector<u_int> > > vec_type; 192 vec_type author_cont; 193 author_cont.reserve(stat->size()); 194 for (MapConstIter_ i= stat->begin(); i != stat->end(); ++i) { 195 author_cont.push_back(std::make_pair(i->first, 196 accumulated(*stat,i->first))); 197 } 198 199 LessReversed<std::vector<u_int> > lr; 200 PairSecondCompare<std::string, std::vector<u_int>, 201 LessReversed<std::vector<u_int> > > compare(lr); 202 std::sort(author_cont.begin(), author_cont.end(), compare); 203 204 size_t plotno=author_cont.size(); 190 205 std::stringstream ss; 191 for (MapConstIter_ i= stat->begin(); i != stat->end(); ++i) { 206 vec_type::iterator end(author_cont.end()); 207 for (vec_type::iterator i(author_cont.begin()); i!=end; ++i) { 192 208 ss.str(""); 193 209 ss << "set key height " << 2*plotno; 194 210 gp->command(ss.str()); 195 std::vector<u_int> x=accumulated(*stat, i->first);196 211 ss.str(""); 197 ss << x.back() << " " << i->first;212 ss << i->second.back() << " " << i->first; 198 213 gp->yrange(yrange_max); 199 214 gp->linetitle(ss.str()); 200 215 ss.str(""); 201 ss << "steps " << ++plotno;216 ss << "steps " << --plotno+2; 202 217 gp->linestyle(ss.str()); 203 gp->plot( x);218 gp->plot(i->second, ss.str()); 204 219 } 205 220 ss.str("");
Note: See TracChangeset
for help on using the changeset viewer.