Changeset 74 for trunk/lib/Stats.cc


Ignore:
Timestamp:
Mar 7, 2006, 4:46:59 PM (16 years ago)
Author:
Jari Häkkinen
Message:

Improved web presentation. Y axises normalized, ticket ticket:15 resolved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Stats.cc

    r73 r74  
    2424  u_int Stats::latest_revision_=0;
    2525
    26   std::vector<double> Stats::accumulated(void) const
     26  std::vector<u_int> Stats::accumulated(void) const
    2727  {
    2828    // sum of all users
     
    3232
    3333    // calculate accumulated sum
    34     std::vector<double> accum(sum.size());
     34    std::vector<u_int> accum(sum.size());
    3535    std::partial_sum(sum.begin(),sum.end(),accum.begin());
    3636    assert(sum.size()==accum.size());
     
    3838  }
    3939
    40   std::vector<double> Stats::accumulated(const std::string& user) const
     40  std::vector<u_int> Stats::accumulated(const std::string& user) const
    4141  {
    4242    if (!map_.count(user))
    43       return std::vector<double>();
     43      return std::vector<u_int>();
    4444    std::vector<u_int> vec=(map_.find(user))->second;
    4545 
     
    4747      vec.insert(vec.end(), latest_revision_+1-vec.size(), 0);
    4848
    49     std::vector<double> accum(vec.size());
     49    std::vector<u_int> accum(vec.size());
    5050    std::partial_sum(vec.begin(),vec.end(),accum.begin());
    5151    return accum;
     
    109109    gp->command("set key left Left reverse");
    110110    gp->command("set multiplot");
    111     std::vector<double> x=accumulated();   
     111    std::vector<u_int> x=accumulated();   
    112112    std::stringstream sa;
    113113    sa << x.back() << " total";
     114    double yrange_max=1.03*x.back()+1;
     115    gp->yrange(yrange_max);
    114116    gp->linetitle(sa.str());
    115117    gp->linestyle("steps 1");
    116118    gp->plot(x);
    117     size_t plotno=2;
     119    size_t plotno=1;
    118120    for (MapConstIter_ i= map_.begin(); i != map_.end(); i++) {
    119121      std::stringstream s0;
    120       s0 << "set key height " << plotno;
     122      s0 << "set key height " << 2*plotno;
    121123      gp->command(s0.str());
    122124      x=accumulated(i->first);
    123125      std::stringstream s;
    124126      s << x.back() << " " << i->first;
     127      gp->yrange(yrange_max);
    125128      gp->linetitle(s.str());
    126129      // Jari, reuse the stream above
    127130      std::stringstream s2;
    128       s2 << "steps " << plotno++;
     131      s2 << "steps " << ++plotno;
    129132      gp->linestyle(s2.str());
    130133      gp->plot(x);
    131134    }
    132135    gp->command("unset multiplot");
     136    gp->yrange();
    133137
    134138    return name;
Note: See TracChangeset for help on using the changeset viewer.