Changeset 399


Ignore:
Timestamp:
Jun 27, 2007, 7:03:39 PM (13 years ago)
Author:
Peter Johansson
Message:

fixes #200. shading is done linearly on x-axis in plot, which mean on time default and on revs when --revisions are used

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/File.cc

    r398 r399  
    9797    HtmlStream hs(os);
    9898    SVNblame blame(path_);
    99     assert(GnuplotFE::instance()->dates().size());
    100     time_t last = Date(GnuplotFE::instance()->dates().back()).seconds();
     99    int last=0;
     100    int first=0;
     101    bool using_dates=true;
     102    if (GnuplotFE::instance()->dates().empty()){
     103      using_dates=false;
     104      last = stats_.revision();
     105    }
     106    else {
     107      last = Date(GnuplotFE::instance()->dates().back()).seconds();
     108      first = Date(GnuplotFE::instance()->dates()[0]).seconds();
     109    }
    101110    // color is calculated linearly on time, c = kt + m
    102111    // brightest color (for oldest rev in log) is set to 192.
    103     double k = 192.0/(Date(GnuplotFE::instance()->dates()[0]).seconds()-last);
     112    double k = 192.0/(first-last);
    104113    double m = -last*k;
    105114    while (blame.valid()) {
    106       std::string color(hex(static_cast<int>(k*Date(blame.date()).seconds()+m),
    107                             2));
     115      std::string color;
     116      if (using_dates)
     117        color=hex(static_cast<int>(k*Date(blame.date()).seconds()+m),2);
     118      else
     119        color=hex(static_cast<int>(k*blame.revision()+m),2);
    108120      os << "<tr>\n<td class=\"number\"><font color=\"#" << color
    109121         << color << color << "\">" << blame.revision()
  • trunk/lib/Stats.h

    r345 r399  
    130130
    131131    ///
    132     ///
     132    /// \return latest revision for whole project
    133133    ///
    134134    inline u_int revision(void) const { return revision_; }
Note: See TracChangeset for help on using the changeset viewer.