Changeset 1327 for trunk


Ignore:
Timestamp:
Jan 27, 2011, 2:23:15 AM (10 years ago)
Author:
Peter Johansson
Message:

refs #489 and #490. Use default tickspacing provided by plplot. With
current implementation, v6.9.6, it means range 6-15 -> spacing=2;
range 15-30 -> spacing=5; range 30-60 -> spacing=10 and similarly for
other order of magnitudes. For dates it is similar, but the unit
changes dynamically depending on the range. Basically they choose the
largest unit of seconds, minutes, hours, days, weeks, and years, such
that range is at least 3 in that unit. So when the range is more than
3 years we're counting in years and when the range is between 3 weeks
and 3 years we're counting in weeks.

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Graph.cc

    r1325 r1327  
    33/*
    44  Copyright (C) 2009, 2010 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2011 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    3839  Graph::Graph(const std::string& filename, const std::string& format)
    3940#ifdef HAVE_PLPLOT
    40     : plots_(0), pls_(1,1,format.c_str(),filename.c_str()), timeformat_("%y-%b"),
     41    : plots_(0), pls_(1,1,format.c_str(),filename.c_str()),
    4142      title_(filename), xmin_(0.0), xmax_(0.0), ymin_(0.0), ymax_(0.0)
    4243  {
     
    108109      std::string xopt("bcnstv");
    109110      if (date_xticks()) {
    110         pls_.timefmt(timeformat_.c_str());
     111        pls_.timefmt("%y-%b");
    111112        xopt="bcnstd";
    112113      }
    113114
    114       unsigned int ytickspacing=tick_spacing(yrange_);
    115       unsigned int xtickspacing=tick_spacing(xrange_);
    116       pls_.box(xopt.c_str(), xtickspacing, 1, "bcnstv", ytickspacing, 2);
     115      pls_.box(xopt.c_str(), 0, 1, "bcnstv", 0, 2);
    117116      pls_.lab("Date", "Number of lines", title_.c_str());
    118117    }
     
    232231
    233232
    234   void Graph::timeformat(const std::string& format)
    235   {
    236     timeformat_=format;
    237   }
    238 
    239 
    240233  const std::vector<time_t>& Graph::xticks(void)
    241234  {
  • trunk/lib/Graph.h

    r1287 r1327  
    127127
    128128    /**
    129        \brief Set x-axis tick value format to \a format. The format is
    130        only used when dates are used.
    131129    */
    132     void timeformat(const std::string& format);
    133 
    134130    static const std::vector<time_t>& xticks(void);
    135131
     
    168164    static svn_revnum_t rev_min_;
    169165    static svn_revnum_t rev_max_;
    170     std::string timeformat_;
    171166    std::string title_;
    172167    static std::vector<time_t> xticks_;
Note: See TracChangeset for help on using the changeset viewer.