Changeset 10923:6e12b80e24c1 in orange


Ignore:
Timestamp:
06/17/12 14:56:43 (22 months ago)
Author:
mstajdohar
Branch:
default
Message:

Added a margin around graph.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/plot/owplot.py

    r10920 r10923  
    14471447        ## We leave a 5% margin on each side so the graph doesn't look overcrowded 
    14481448        ## TODO: Perhaps change this from a fixed percentage to always round to a round number 
    1449         dx = r.width()/20.0 
    1450         dy = r.height()/20.0 
     1449        dx = r.width() / 20.0 
     1450        dy = r.height() / 20.0 
    14511451        r.adjust(-dx, -dy, dx, dy) 
    14521452        return r 
     
    15071507            lower, upper = orangeqt.Plot.bounds_for_axis(self, axis_id) 
    15081508            if lower != upper: 
    1509           lower = lower - (upper-lower)/20.0 
    1510           upper = upper + (upper-lower)/20.0 
    1511         return lower, upper 
     1509                lower = lower - (upper-lower)/20.0 
     1510                upper = upper + (upper-lower)/20.0 
     1511            return lower, upper 
    15121512        else: 
    15131513            return None, None 
     
    17171717 
    17181718    def zoom_to_rect(self, rect): 
     1719        print len(self.zoom_stack) 
    17191720        self.ensure_inside(rect, self.graph_area) 
    1720         self.zoom_stack.append(self.zoom_rect) 
     1721 
     1722        # add to zoom_stack if zoom_rect is larger 
     1723        if self.zoom_rect.width() > rect.width() or self.zoom_rect.height() > rect.height(): 
     1724            self.zoom_stack.append(self.zoom_rect) 
     1725 
    17211726        self.animate(self, 'zoom_rect', rect, start_val = self.get_zoom_rect()) 
    17221727         
    17231728    def zoom_back(self): 
     1729        print len(self.zoom_stack) 
    17241730        if self.zoom_stack: 
    17251731            rect = self.zoom_stack.pop() 
     
    17401746         
    17411747    def zoom(self, point, scale): 
     1748        print len(self.zoom_stack) 
    17421749        t, ok = self._zoom_transform.inverted() 
    17431750        point = point * t 
     
    17481755         
    17491756        self.ensure_inside(r, self.graph_area) 
     1757 
     1758        # remove smaller zoom rects from stack 
     1759        while len(self.zoom_stack) > 0 and r.width() >= self.zoom_stack[-1].width() and r.height() >= self.zoom_stack[-1].height(): 
     1760            self.zoom_stack.pop() 
     1761 
    17501762        self.zoom_to_rect(r) 
    17511763         
  • source/orangeqt/networkcurve.cpp

    r10922 r10923  
    996996            QRectF r1 = plot()->data_rect_for_axes(axes_.first, axes_.second); 
    997997 
     998            double dx = r1.width() / 20.0; 
     999            double dy = r1.height() / 20.0; 
     1000            r1.adjust(-dx, -dy, dx, dy); 
     1001 
    9981002            QTransform tr1 = QTransform().translate(-r1.left(), -r1.top()); 
    9991003            QTransform ts = QTransform().scale(r2.width()/r1.width(), r2.height()/r1.height()); 
Note: See TracChangeset for help on using the changeset viewer.