Example #1
0
    def makeLines(self):
        bubblePlot = getattr(self,'_bubblePlot',None)
        assert not bubblePlot, "_bubblePlot not supported for 3d yet"
        #if bubblePlot:
        #   yA = self.yValueAxis
        #   xA = self.xValueAxis
        #   bubbleR = min(yA._bubbleRadius,xA._bubbleRadius)
        #   bubbleMax = xA._bubbleMax

        labelFmt = self.lineLabelFormat
        positions = self._positions

        P = range(len(positions))
        if self.reversePlotOrder: P.reverse()
        inFill = getattr(self,'_inFill',None)
        assert not inFill, "inFill not supported for 3d yet"
        #if inFill:
        #   inFillY = self.xValueAxis._y
        #   inFillX0 = self.yValueAxis._x
        #   inFillX1 = inFillX0 + self.xValueAxis._length
        #   inFillG = getattr(self,'_inFillG',g)
        zDepth = self.zDepth
        _zadjust = self._zadjust
        theta_x = self.theta_x
        theta_y = self.theta_y
        from linecharts import _FakeGroup
        F = _FakeGroup()

        from utils3d import _make_3d_line_info, find_intersections
        if self.xValueAxis.style!='parallel_3d':
            tileWidth = getattr(self,'_3d_tilewidth',1)
            if getattr(self,'_find_intersections',None):
                from copy import copy
                fpositions = map(copy,positions)
                I = find_intersections(fpositions,small=tileWidth)
                ic = None
                for i,j,x,y in I:
                    if ic!=i:
                        ic = i
                        jc = 0
                    else:
                        jc+=1
                    fpositions[i].insert(j+jc,(x,y))
                tileWidth = None
            else:
                fpositions = positions
        else:
            tileWidth = None
            fpositions = positions

        # Iterate over data rows.
        styleCount = len(self.lines)
        for rowNo in P:
            row = positions[rowNo]
            n = len(row)
            rowStyle = self.lines[rowNo % styleCount]
            rowColor = rowStyle.strokeColor
            dash = getattr(rowStyle, 'strokeDashArray', None)
            z0 = self._calc_z0(rowNo)
            z1 = z0 + zDepth

            if hasattr(rowStyle, 'strokeWidth'):
                width = rowStyle.strokeWidth
            elif hasattr(self.lines, 'strokeWidth'):
                width = self.lines.strokeWidth
            else:
                width = None

            # Iterate over data columns.
            if self.joinedLines:
                if n:
                    frow = fpositions[rowNo]
                    x0, y0 = frow[0]
                    for colNo in xrange(1,len(frow)):
                        x1, y1 = frow[colNo]
                        _make_3d_line_info( F, x0, x1, y0, y1, z0, z1,
                                theta_x, theta_y,
                                rowColor, fillColorShaded=None, tileWidth=tileWidth,
                                strokeColor=None, strokeWidth=None, strokeDashArray=None,
                                shading=0.1)
                        x0, y0 = x1, y1

            if hasattr(rowStyle, 'symbol'):
                uSymbol = rowStyle.symbol
            elif hasattr(self.lines, 'symbol'):
                uSymbol = self.lines.symbol
            else:
                uSymbol = None

            if uSymbol:
                for xy in row:
                    x1, y1 = row[colNo]
                    x1, y1 = _zadjust(x1,y1,z0)
                    symbol = uSymbol2Symbol(uSymbol,xy[0],xy[1],rowColor)
                    if symbol: F.add((1,z0,z0,x1,y1,symbol))

            # Draw data labels.
            for colNo in xrange(n):
                x1, y1 = row[colNo]
                x1, y1 = _zadjust(x1,y1,z0)
                L = self._innerDrawLabel(rowNo, colNo, x1, y1)
                if L: F.add((2,z0,z0,x1,y1,L))

        F.sort()
        g = Group()
        for v in F.value(): g.add(v[-1])
        return g
Example #2
0
    def makeLines(self):
        labelFmt = self.lineLabelFormat
        P = range(len(self._positions))
        if self.reversePlotOrder: P.reverse()
        inFill = self.inFill
        assert not inFill, "inFill not supported for 3d yet"
        #if inFill:
        #inFillY = self.categoryAxis._y
        #inFillX0 = self.valueAxis._x
        #inFillX1 = inFillX0 + self.categoryAxis._length
        #inFillG = getattr(self,'_inFillG',g)
        zDepth = self.zDepth
        _zadjust = self._zadjust
        theta_x = self.theta_x
        theta_y = self.theta_y
        F = _FakeGroup()
        from utils3d import _make_3d_line_info
        tileWidth = getattr(self, '_3d_tilewidth', None)
        if not tileWidth and self.categoryAxis.style != 'parallel_3d':
            tileWidth = 1

        # Iterate over data rows.
        for rowNo in P:
            row = self._positions[rowNo]
            n = len(row)
            styleCount = len(self.lines)
            styleIdx = rowNo % styleCount
            rowStyle = self.lines[styleIdx]
            rowColor = rowStyle.strokeColor
            dash = getattr(rowStyle, 'strokeDashArray', None)
            z0 = self._calc_z0(rowNo)
            z1 = z0 + zDepth

            if hasattr(self.lines[styleIdx], 'strokeWidth'):
                strokeWidth = self.lines[styleIdx].strokeWidth
            elif hasattr(self.lines, 'strokeWidth'):
                strokeWidth = self.lines.strokeWidth
            else:
                strokeWidth = None

            # Iterate over data columns.
            if self.joinedLines:
                if n:
                    x0, y0 = row[0]
                    for colNo in xrange(1, n):
                        x1, y1 = row[colNo]
                        _make_3d_line_info(F,
                                           x0,
                                           x1,
                                           y0,
                                           y1,
                                           z0,
                                           z1,
                                           theta_x,
                                           theta_y,
                                           rowColor,
                                           fillColorShaded=None,
                                           tileWidth=tileWidth,
                                           strokeColor=None,
                                           strokeWidth=None,
                                           strokeDashArray=None,
                                           shading=0.1)
                        x0, y0 = x1, y1

            if hasattr(self.lines[styleIdx], 'symbol'):
                uSymbol = self.lines[styleIdx].symbol
            elif hasattr(self.lines, 'symbol'):
                uSymbol = self.lines.symbol
            else:
                uSymbol = None

            if uSymbol:
                for colNo in xrange(n):
                    x1, y1 = row[colNo]
                    x1, y1 = _zadjust(x1, y1, z0)
                    symbol = uSymbol2Symbol(uSymbol, x1, y1, rowColor)
                    if symbol: F.add((2, z0, z0, x1, y1, symbol))

            # Draw item labels.
            for colNo in xrange(n):
                x1, y1 = row[colNo]
                x1, y1 = _zadjust(x1, y1, z0)
                L = self._innerDrawLabel(rowNo, colNo, x1, y1)
                if L: F.add((2, z0, z0, x1, y1, L))

        F.sort()
        g = Group()
        for v in F.value():
            g.add(v[-1])
        return g
Example #3
0
    def makeLines(self):
        bubblePlot = getattr(self, '_bubblePlot', None)
        assert not bubblePlot, "_bubblePlot not supported for 3d yet"
        #if bubblePlot:
        #   yA = self.yValueAxis
        #   xA = self.xValueAxis
        #   bubbleR = min(yA._bubbleRadius,xA._bubbleRadius)
        #   bubbleMax = xA._bubbleMax

        labelFmt = self.lineLabelFormat
        positions = self._positions

        P = range(len(positions))
        if self.reversePlotOrder: P.reverse()
        inFill = getattr(self, '_inFill', None)
        assert not inFill, "inFill not supported for 3d yet"
        #if inFill:
        #   inFillY = self.xValueAxis._y
        #   inFillX0 = self.yValueAxis._x
        #   inFillX1 = inFillX0 + self.xValueAxis._length
        #   inFillG = getattr(self,'_inFillG',g)
        zDepth = self.zDepth
        _zadjust = self._zadjust
        theta_x = self.theta_x
        theta_y = self.theta_y
        from linecharts import _FakeGroup
        F = _FakeGroup()

        from utils3d import _make_3d_line_info, find_intersections
        if self.xValueAxis.style != 'parallel_3d':
            tileWidth = getattr(self, '_3d_tilewidth', 1)
            if getattr(self, '_find_intersections', None):
                from copy import copy
                fpositions = map(copy, positions)
                I = find_intersections(fpositions, small=tileWidth)
                ic = None
                for i, j, x, y in I:
                    if ic != i:
                        ic = i
                        jc = 0
                    else:
                        jc += 1
                    fpositions[i].insert(j + jc, (x, y))
                tileWidth = None
            else:
                fpositions = positions
        else:
            tileWidth = None
            fpositions = positions

        # Iterate over data rows.
        styleCount = len(self.lines)
        for rowNo in P:
            row = positions[rowNo]
            n = len(row)
            rowStyle = self.lines[rowNo % styleCount]
            rowColor = rowStyle.strokeColor
            dash = getattr(rowStyle, 'strokeDashArray', None)
            z0 = self._calc_z0(rowNo)
            z1 = z0 + zDepth

            if hasattr(rowStyle, 'strokeWidth'):
                width = rowStyle.strokeWidth
            elif hasattr(self.lines, 'strokeWidth'):
                width = self.lines.strokeWidth
            else:
                width = None

            # Iterate over data columns.
            if self.joinedLines:
                if n:
                    frow = fpositions[rowNo]
                    x0, y0 = frow[0]
                    for colNo in xrange(1, len(frow)):
                        x1, y1 = frow[colNo]
                        _make_3d_line_info(F,
                                           x0,
                                           x1,
                                           y0,
                                           y1,
                                           z0,
                                           z1,
                                           theta_x,
                                           theta_y,
                                           rowColor,
                                           fillColorShaded=None,
                                           tileWidth=tileWidth,
                                           strokeColor=None,
                                           strokeWidth=None,
                                           strokeDashArray=None,
                                           shading=0.1)
                        x0, y0 = x1, y1

            if hasattr(rowStyle, 'symbol'):
                uSymbol = rowStyle.symbol
            elif hasattr(self.lines, 'symbol'):
                uSymbol = self.lines.symbol
            else:
                uSymbol = None

            if uSymbol:
                for xy in row:
                    x1, y1 = row[colNo]
                    x1, y1 = _zadjust(x1, y1, z0)
                    symbol = uSymbol2Symbol(uSymbol, xy[0], xy[1], rowColor)
                    if symbol: F.add((1, z0, z0, x1, y1, symbol))

            # Draw data labels.
            for colNo in xrange(n):
                x1, y1 = row[colNo]
                x1, y1 = _zadjust(x1, y1, z0)
                L = self._innerDrawLabel(rowNo, colNo, x1, y1)
                if L: F.add((2, z0, z0, x1, y1, L))

        F.sort()
        g = Group()
        for v in F.value():
            g.add(v[-1])
        return g
Example #4
0
    def makeLines(self):
        labelFmt = self.lineLabelFormat
        P = range(len(self._positions))
        if self.reversePlotOrder: P.reverse()
        inFill = self.inFill
        assert not inFill, "inFill not supported for 3d yet"
        #if inFill:
            #inFillY = self.categoryAxis._y
            #inFillX0 = self.valueAxis._x
            #inFillX1 = inFillX0 + self.categoryAxis._length
            #inFillG = getattr(self,'_inFillG',g)
        zDepth = self.zDepth
        _zadjust = self._zadjust
        theta_x = self.theta_x
        theta_y = self.theta_y
        F = _FakeGroup()
        from utils3d import _make_3d_line_info
        tileWidth = getattr(self,'_3d_tilewidth',None)
        if not tileWidth and self.categoryAxis.style!='parallel_3d': tileWidth = 1

        # Iterate over data rows.
        for rowNo in P:
            row = self._positions[rowNo]
            n = len(row)
            styleCount = len(self.lines)
            styleIdx = rowNo % styleCount
            rowStyle = self.lines[styleIdx]
            rowColor = rowStyle.strokeColor
            dash = getattr(rowStyle, 'strokeDashArray', None)
            z0 = self._calc_z0(rowNo)
            z1 = z0 + zDepth

            if hasattr(self.lines[styleIdx], 'strokeWidth'):
                strokeWidth = self.lines[styleIdx].strokeWidth
            elif hasattr(self.lines, 'strokeWidth'):
                strokeWidth = self.lines.strokeWidth
            else:
                strokeWidth = None

            # Iterate over data columns.
            if self.joinedLines:
                if n:
                    x0, y0 = row[0]
                    for colNo in xrange(1,n):
                        x1, y1 = row[colNo]
                        _make_3d_line_info( F, x0, x1, y0, y1, z0, z1,
                                theta_x, theta_y,
                                rowColor, fillColorShaded=None, tileWidth=tileWidth,
                                strokeColor=None, strokeWidth=None, strokeDashArray=None,
                                shading=0.1)
                        x0, y0 = x1, y1

            if hasattr(self.lines[styleIdx], 'symbol'):
                uSymbol = self.lines[styleIdx].symbol
            elif hasattr(self.lines, 'symbol'):
                uSymbol = self.lines.symbol
            else:
                uSymbol = None

            if uSymbol:
                for colNo in xrange(n):
                    x1, y1 = row[colNo]
                    x1, y1 = _zadjust(x1,y1,z0)
                    symbol = uSymbol2Symbol(uSymbol,x1,y1,rowColor)
                    if symbol: F.add((2,z0,z0,x1,y1,symbol))

            # Draw item labels.
            for colNo in xrange(n):
                x1, y1 = row[colNo]
                x1, y1 = _zadjust(x1,y1,z0)
                L = self._innerDrawLabel(rowNo, colNo, x1, y1)
                if L: F.add((2,z0,z0,x1,y1,L))

        F.sort()
        g = Group()
        for v in F.value(): g.add(v[-1])
        return g