Changeset 8621:050b4b8a85f5 in orange


Ignore:
Timestamp:
08/05/11 19:32:14 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
addca24d36e2eaa1bdc776e4bc1822e71e8cbf57
Message:

Use OWAxis in Parallel Coordinates Qt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Prototypes/OWParallelGraphQt.py

    r8620 r8621  
    184184        # ############################################ 
    185185        # draw vertical lines that represent attributes 
     186        self.remove_all_axes() 
    186187        for i in range(len(attributes)): 
    187             self.addCurve("", lineWidth = 2, style = OWCurve.Lines, symbol = OWPoint.NoSymbol, xData = [i,i], yData = [0,1]) 
     188        self.add_axis(UserAxis + i, line = QLineF(i, 0, i, 1), arrows = AxisStart | AxisEnd) 
    188189            if self.showAttrValues == 1: 
    189190                attr = self.dataDomain[attributes[i]] 
    190191                if attr.varType == orange.VarTypes.Continuous: 
    191                     strVal1 = "%%.%df" % (attr.numberOfDecimals) % (self.attrValues[attr.name][0]) 
    192                     strVal2 = "%%.%df" % (attr.numberOfDecimals) % (self.attrValues[attr.name][1]) 
    193                     align1 = i == 0 and Qt.AlignRight | Qt.AlignBottom or i == len(attributes)-1 and Qt.AlignLeft | Qt.AlignBottom or Qt.AlignHCenter | Qt.AlignBottom 
    194                     align2 = i == 0 and Qt.AlignRight | Qt.AlignTop or i == len(attributes)-1 and Qt.AlignLeft | Qt.AlignTop or Qt.AlignHCenter | Qt.AlignTop 
    195                     self.addMarker(strVal1, i, 0.0-0.01, alignment = align1) 
    196                     self.addMarker(strVal2, i, 1.0+0.01, alignment = align2) 
    197  
     192            self.set_axis_scale(UserAxis + i, 0.0-0.01, 1.0+0.01) 
    198193                elif attr.varType == orange.VarTypes.Discrete: 
    199                     attrVals = getVariableValuesSorted(self.dataDomain[attributes[i]]) 
    200                     valsLen = len(attrVals) 
    201                     for pos in range(len(attrVals)): 
    202                         # show a rectangle behind the marker 
    203                         self.addMarker(attrVals[pos], i+0.01, float(1+2*pos)/float(2*valsLen), alignment = Qt.AlignRight | Qt.AlignVCenter, bold = 1, brushColor = Qt.white) 
     194            attrVals = getVariableValuesSorted(self.dataDomain[attributes[i]]) 
     195            self.set_axis_labels(UserAxis + i, attrVals) 
    204196 
    205197        # ############################################## 
Note: See TracChangeset for help on using the changeset viewer.