Changeset 8284:81d7046a7680 in orange


Ignore:
Timestamp:
05/29/11 14:18:56 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
c60a24bbb02cc2c1e3bc7651f624e0f92750cdcc
Message:

Rotate axis labels so they are parallel to the axis line

Location:
orange/OrangeWidgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Graph/axis.py

    r8280 r8284  
    1212    .. method:: make_title 
    1313        Makes a pretty title, with the quantity title in italics and the unit in normal text 
     14         
     15    .. method:: label_pos 
     16        Controls where the axis title and tick marks are placed relative to the axis 
    1417""" 
    1518 
     
    1821 
    1922from palette import * 
     23 
     24LabelBelow = 0 
     25LabelAbove = 1 
     26LabelLeft = 2 
     27LabelRight = 3 
    2028 
    2129class Axis(QGraphicsItemGroup): 
     
    3745        self.line_item.setPen(self.style.pen()) 
    3846        self.title_item.setHtml(self.title) 
     47        title_pos = (self.line.p1() + self.line.p2())/2 
     48        ## TODO: Move it according to self.label_pos 
     49        self.title_item.setPos(title_pos) 
     50        self.title_item.setRotation(self.line.angle()) 
    3951         
    4052    @staticmethod 
     
    5870         
    5971    def set_scale(self, min, max, step_size): 
    60         # TODO 
    61         pass 
     72        self.scale = (min, max, step_size) 
     73        self.update() 
    6274     
    6375    def set_tick_length(self, minor, medium, major): 
    64         # TODO 
    65         pass 
     76        self.tick_length = (minor, medium, major) 
     77        self.update() 
    6678         
    6779     
  • orange/OrangeWidgets/QtGraph.py

    r8283 r8284  
    370370                line = QLineF(rect.bottomLeft(), rect.bottomRight()) 
    371371            elif id is yLeft: 
    372                 line = QLineF(rect.bottomRight(), rect.topRight()) 
     372                line = QLineF(rect.topRight(), rect.bottomRight()) 
    373373            elif id is yRight: 
    374                 line = QLineF(rect.bottomRight(), rect.topRight()) 
     374                line = QLineF(rect.topLeft(), rect.bottomLeft()) 
    375375            line.translate(-rect.topLeft()) 
    376376            self.axes[id] = axis.Axis(rect.size(), 'Test', line ) 
Note: See TracChangeset for help on using the changeset viewer.