• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python markers.makeMarker函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中reportlab.graphics.widgets.markers.makeMarker函数的典型用法代码示例。如果您正苦于以下问题:Python makeMarker函数的具体用法?Python makeMarker怎么用?Python makeMarker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了makeMarker函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: sample1c

def sample1c():
    "A line plot with non-equidistant points in x-axis."

    drawing = Drawing(400, 200)

    data = [
            ((1,1), (2,2), (2.5,1), (3,3), (4,5)),
            ((1,2), (2,3), (2.5,2), (3.5,5), (4,6))
        ]

    lp = LinePlot()

    lp.x = 50
    lp.y = 50
    lp.height = 125
    lp.width = 300
    lp.data = data
    lp.joinedLines = 1
    lp.lines[0].symbol = makeMarker('FilledCircle')
    lp.lines[1].symbol = makeMarker('Circle')
    lp.lineLabelFormat = '%2.0f'
    lp.strokeColor = colors.black

    lp.xValueAxis.valueMin = 0
    lp.xValueAxis.valueMax = 5
    lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
    lp.xValueAxis.labelTextFormat = '%2.1f'

    lp.yValueAxis.valueMin = 0
    lp.yValueAxis.valueMax = 7
    lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]

    drawing.add(lp)

    return drawing
开发者ID:SongJLG,项目名称:johan-doc,代码行数:35,代码来源:lineplots.py


示例2: autoLegender

def autoLegender(i, chart, styleObj, sym="symbol"):
    if sym:
        setattr(styleObj[0], sym, makeMarker("Diamond", size=6))
        setattr(styleObj[1], sym, makeMarker("Square"))
    width = 300
    height = 150
    legend = Legend()
    legend.x = width - 5
    legend.y = 5
    legend.dx = 20
    legend.dy = 5
    legend.deltay = 0
    legend.boxAnchor = "se"
    if i == "col auto":
        legend.colorNamePairs[0] = (Auto(chart=chart), "auto chart=self.chart")
        legend.colorNamePairs[1] = (Auto(obj=chart, index=1), "auto  chart=self.chart index=1")
    elif i == "full auto":
        legend.colorNamePairs = Auto(chart=chart)
    elif i == "swatch set":
        legend.swatchMarker = makeMarker("Circle")
        legend.swatchMarker.size = 10
    elif i == "swatch auto":
        legend.swatchMarker = Auto(chart=chart)
    d = Drawing(width, height)
    d.background = Rect(0, 0, width, height, strokeWidth=1, strokeColor=colors.red, fillColor=None)
    m = makeMarker("Cross")
    m.x = width - 5
    m.y = 5
    m.fillColor = colors.red
    m.strokeColor = colors.yellow
    d.add(chart)
    d.add(legend)
    d.add(m)
    return d
开发者ID:sylex-team,项目名称:reportlab-patched,代码行数:34,代码来源:test_graphics_charts.py


示例3: demo

    def demo(self):
        """Shows basic use of a line chart."""

        drawing = Drawing(400, 200)

        data = [((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)), ((1, 2), (2, 3), (2.5, 2), (3.5, 5), (4, 6))]

        lp = LinePlot()

        lp.x = 50
        lp.y = 50
        lp.height = 125
        lp.width = 300
        lp.data = data
        lp.joinedLines = 1
        lp.lineLabelFormat = "%2.0f"
        lp.strokeColor = colors.black

        lp.lines[0].strokeColor = colors.red
        lp.lines[0].symbol = makeMarker("FilledCircle")
        lp.lines[1].strokeColor = colors.blue
        lp.lines[1].symbol = makeMarker("FilledDiamond")

        lp.xValueAxis.valueMin = 0
        lp.xValueAxis.valueMax = 5
        lp.xValueAxis.valueStep = 1

        lp.yValueAxis.valueMin = 0
        lp.yValueAxis.valueMax = 7
        lp.yValueAxis.valueStep = 1

        drawing.add(lp)

        return drawing
开发者ID:eaudeweb,项目名称:naaya,代码行数:34,代码来源:lineplots.py


示例4: autoLegender

def autoLegender(i,chart,styleObj,sym='symbol'):
    if sym:
        setattr(styleObj[0],sym, makeMarker('Diamond',size=6))
        setattr(styleObj[1],sym,makeMarker('Square'))
    width = 300
    height = 150
    legend = Legend()
    legend.x = width-5
    legend.y = 5
    legend.dx = 20
    legend.dy = 5
    legend.deltay = 0
    legend.boxAnchor = 'se'
    if i=='col auto':
        legend.colorNamePairs[0]=(Auto(chart=chart),'auto chart=self.chart')
        legend.colorNamePairs[1]=(Auto(obj=chart,index=1),'auto  chart=self.chart index=1')
    elif i=='full auto':
        legend.colorNamePairs=Auto(chart=chart)
    elif i=='swatch set':
        legend.swatchMarker=makeMarker('Circle')
        legend.swatchMarker.size = 10
    elif i=='swatch auto':
        legend.swatchMarker=Auto(chart=chart)
    d = Drawing(width,height)
    d.background = Rect(0,0,width,height,strokeWidth=1,strokeColor=colors.red,fillColor=None)
    m = makeMarker('Cross')
    m.x = width-5
    m.y = 5
    m.fillColor = colors.red
    m.strokeColor = colors.yellow
    d.add(chart)
    d.add(legend)
    d.add(m)
    return d
开发者ID:Jbaumotte,项目名称:web2py,代码行数:34,代码来源:test_graphics_charts.py


示例5: _render

    def _render(self, drawing):
        if not self._labels:
            return

        gap = 5
        lc1 = linecharts.HorizontalLineChart()
        lc1.data = [self._data[0]]
        lc1.lines.symbol = markers.makeMarker('FilledCircle')
        lc1.categoryAxis.categoryNames = self._labels
        lc1.lineLabelFormat = '%2.0f'

        legend = None
        legend_height = 0
        if self.kw.get('legendlabels', False):
            legend_height = 40
            colors_list = []
            for i in xrange(len(self._data)):
                colors_list.append(lc1.lines[i].strokeColor)

            legend = legends.LineLegend()
            legend.alignment = 'right'
            legend.x = 4 * gap
            legend.y = drawing.height - lc1.y - gap
            legend.deltay = 60
            legend.dxTextSpace = 5
            legend.columnMaximum = 1
            legend.colorNamePairs = zip(colors_list,
                                        self.kw.get('legendlabels'))

        lc1.x = 20
        lc1.y = 20
        lc1.height = self.height - lc1.y - legend_height
        lc1.width = self.width - 1.5 * lc1.x
        lc1.lineLabels.dx = -7
        lc1.lineLabels.fillColor = colors.red

        lc2 = linecharts.HorizontalLineChart()
        lc2.data = [self._data[1]]
        lc2.lines.symbol = markers.makeMarker('FilledCircle')
        lc2.categoryAxis.categoryNames = self._labels
        lc2.lineLabelFormat = '%2.0f'
        lc2.lineLabels.dx = 7
        lc2.lineLabels.fillColor = colors.green
        lc2.valueAxis.strokeColor = colors.green
        # lc2.valueAxis
        lc2.categoryAxis.visible = False

        lc2.x = 20
        lc2.y = 20
        lc2.height = self.height - lc2.y - legend_height
        lc2.width = self.width - 1.5 * lc1.x
        lc2.valueAxis.joinAxisMode = 'right'
        lc2.lines[0].strokeColor = colors.green

        drawing.add(lc1)
        drawing.add(lc2)
        if legend:
            drawing.add(legend, 'legend')
开发者ID:droodle,项目名称:eureka-opensource,代码行数:58,代码来源:comp.py


示例6: sample3

def sample3():
    drawing = Drawing(400, 200)

    data = [
            (13, 5, 20, 22, 37, 45, 19, 4),
            (5, 20, 46, 38, 23, 21, 6, 14)
            ]

    lc = HorizontalLineChart()

    lc.x = 50
    lc.y = 50
    lc.height = 125
    lc.width = 300
    lc.data = data
    lc.joinedLines = 1
    lc.lineLabelFormat = '%2.0f'
    lc.strokeColor = colors.black

    lc.lines[0].symbol = makeMarker('Smiley')
    lc.lines[1].symbol = NoEntry
    lc.lines[0].strokeWidth = 2
    lc.lines[1].strokeWidth = 4

    catNames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ')
    lc.categoryAxis.categoryNames = catNames
    lc.categoryAxis.labels.boxAnchor = 'n'

    lc.valueAxis.valueMin = 0
    lc.valueAxis.valueMax = 60
    lc.valueAxis.valueStep = 15

    drawing.add(lc)

    return drawing
开发者ID:wolf29,项目名称:EG-notifications,代码行数:35,代码来源:linecharts.py


示例7: sample2

def sample2():
    "A line plot with non-equidistant points in x-axis."

    drawing = Drawing(400, 200)

    data = [
        (
            ("25/11/1991", 1),
            ("30/11/1991", 1.000933333),
            ("31/12/1991", 1.0062),
            ("31/01/1992", 1.0112),
            ("29/02/1992", 1.0158),
            ("31/03/1992", 1.020733333),
            ("30/04/1992", 1.026133333),
            ("31/05/1992", 1.030266667),
            ("30/06/1992", 1.034466667),
            ("31/07/1992", 1.038733333),
            ("31/08/1992", 1.0422),
            ("30/09/1992", 1.045533333),
            ("31/10/1992", 1.049866667),
            ("30/11/1992", 1.054733333),
            ("31/12/1992", 1.061),
        )
    ]

    data[0] = preprocessData(data[0])

    lp = LinePlot()

    lp.x = 50
    lp.y = 50
    lp.height = 125
    lp.width = 300
    lp.data = data
    lp.joinedLines = 1
    lp.lines.symbol = makeMarker("FilledDiamond")
    lp.strokeColor = colors.black

    start = mktime(mkTimeTuple("25/11/1991"))
    t0 = mktime(mkTimeTuple("30/11/1991"))
    t1 = mktime(mkTimeTuple("31/12/1991"))
    t2 = mktime(mkTimeTuple("31/03/1992"))
    t3 = mktime(mkTimeTuple("30/06/1992"))
    t4 = mktime(mkTimeTuple("30/09/1992"))
    end = mktime(mkTimeTuple("31/12/1992"))
    lp.xValueAxis.valueMin = start
    lp.xValueAxis.valueMax = end
    lp.xValueAxis.valueSteps = [start, t0, t1, t2, t3, t4, end]
    lp.xValueAxis.labelTextFormat = seconds2str
    lp.xValueAxis.labels[1].dy = -20
    lp.xValueAxis.labels[2].dy = -35

    lp.yValueAxis.labelTextFormat = "%4.2f"
    lp.yValueAxis.valueMin = 100
    lp.yValueAxis.valueMax = 110
    lp.yValueAxis.valueStep = 2

    drawing.add(lp)

    return drawing
开发者ID:eaudeweb,项目名称:naaya,代码行数:60,代码来源:lineplots.py


示例8: sample1a

def sample1a():
    "A line plot with non-equidistant points in x-axis."

    drawing = Drawing(400, 200)

    data = [((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)), ((1, 2), (2, 3), (2.5, 2), (3.5, 5), (4, 6))]

    lp = LinePlot()

    lp.x = 50
    lp.y = 50
    lp.height = 125
    lp.width = 300
    lp.data = data
    lp.joinedLines = 1
    lp.strokeColor = colors.black

    lp.lines.symbol = makeMarker("UK_Flag")

    lp.lines[0].strokeWidth = 2
    lp.lines[1].strokeWidth = 4

    lp.xValueAxis.valueMin = 0
    lp.xValueAxis.valueMax = 5
    lp.xValueAxis.valueStep = 1

    lp.yValueAxis.valueMin = 0
    lp.yValueAxis.valueMax = 7
    lp.yValueAxis.valueStep = 1

    drawing.add(lp)

    return drawing
开发者ID:eaudeweb,项目名称:naaya,代码行数:33,代码来源:lineplots.py


示例9: sample2

def sample2():
    drawing = Drawing(400, 200)

    data = [(13, 5, 20, 22, 37, 45, 19, 4), (5, 20, 46, 38, 23, 21, 6, 14)]

    lc = HorizontalLineChart()

    lc.x = 50
    lc.y = 50
    lc.height = 125
    lc.width = 300
    lc.data = data
    lc.joinedLines = 1
    lc.lines.symbol = makeMarker("Smiley")
    lc.lineLabelFormat = "%2.0f"
    lc.strokeColor = colors.black
    lc.fillColor = colors.lightblue

    catNames = "Jan Feb Mar Apr May Jun Jul Aug".split(" ")
    lc.categoryAxis.categoryNames = catNames
    lc.categoryAxis.labels.boxAnchor = "n"

    lc.valueAxis.valueMin = 0
    lc.valueAxis.valueMax = 60
    lc.valueAxis.valueStep = 15

    drawing.add(lc)

    return drawing
开发者ID:Nuevosmedios,项目名称:quicklearn-env,代码行数:29,代码来源:linecharts.py


示例10: line_plot

 def line_plot(O, xy_max, data, label_font_size):
   if (reportlab is None): return
   from reportlab.graphics.charts.lineplots import LinePlot
   from reportlab.graphics.widgets.markers import makeMarker
   from reportlab.lib import colors
   lp = LinePlot()
   lp.x = 40
   lp.y = 40
   lp.height = 120
   lp.width = 120
   lp.data = [[(0,0),(xy_max,xy_max)], data]
   lp.lines[0].strokeColor = colors.Color(*[0.8]*3)
   lp.lines[0].strokeWidth = 0.5
   lp.lines[1].strokeColor = colors.white
   lp.lines[1].strokeWidth = 0
   lp.lines[1].symbol = makeMarker("Circle")
   lp.lines[1].symbol.strokeWidth = 0.5
   lp.joinedLines = 1
   lp.strokeColor = colors.Color(*[0.8]*3)
   lp.strokeWidth = 1
   lp.xValueAxis.valueMin = 0
   lp.xValueAxis.valueMax = xy_max
   lp.xValueAxis.valueSteps = range(xy_max+1)
   lp.xValueAxis.strokeWidth = 1
   lp.xValueAxis.tickDown = 3
   lp.xValueAxis.labels.fontSize = label_font_size
   lp.yValueAxis.valueMin = 0
   lp.yValueAxis.valueMax = xy_max
   lp.yValueAxis.valueSteps = range(xy_max+1)
   lp.yValueAxis.strokeWidth = 1
   lp.yValueAxis.tickLeft = 3
   lp.yValueAxis.labels.fontSize = label_font_size
   return lp
开发者ID:cctbx,项目名称:cctbx-playground,代码行数:33,代码来源:tst_tardy_eval.py


示例11: sample1a

def sample1a():
    drawing = Drawing(400, 200)

    data = [
            (13, 5, 20, 22, 37, 45, 19, 4),
            (5, 20, 46, 38, 23, 21, 6, 14)
            ]

    lc = SampleHorizontalLineChart()

    lc.x = 50
    lc.y = 50
    lc.height = 125
    lc.width = 300
    lc.data = data
    lc.joinedLines = 1
    lc.strokeColor = colors.white
    lc.fillColor = colors.HexColor(0xCCCCCC)
    lc.lines.symbol = makeMarker('FilledDiamond')
    lc.lineLabelFormat = '%2.0f'

    catNames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ')
    lc.categoryAxis.categoryNames = catNames
    lc.categoryAxis.labels.boxAnchor = 'n'

    lc.valueAxis.valueMin = 0
    lc.valueAxis.valueMax = 60
    lc.valueAxis.valueStep = 15

    drawing.add(lc)

    return drawing
开发者ID:wolf29,项目名称:EG-notifications,代码行数:32,代码来源:linecharts.py


示例12: sample2

def sample2():
    "Make a spider chart with markers, but no fill"
    d = Drawing(400, 400)
    sp = SpiderChart()
    sp.x = 50
    sp.y = 50
    sp.width = 300
    sp.height = 300
    sp.data = [[10,12,14,16,14,12], [6,8,10,12,9,15],[7,8,17,4,12,8]]
    sp.labels = ['U','V','W','X','Y','Z']
    sp.strands.strokeWidth = 1
    sp.strands[0].fillColor = colors.pink
    sp.strands[1].fillColor = colors.lightblue
    sp.strands[2].fillColor = colors.palegreen
    sp.strands[0].strokeColor = colors.red
    sp.strands[1].strokeColor = colors.blue
    sp.strands[2].strokeColor = colors.green
    sp.strands.symbol = "FilledDiamond"
    sp.strands[1].symbol = makeMarker("Circle")
    sp.strands[1].symbol.strokeWidth = 0.5
    sp.strands[1].symbol.fillColor = colors.yellow
    sp.strands.symbolSize = 6
    sp.strandLabels[0,3]._text = 'special'
    sp.strandLabels[0,1]._text = 'one'
    sp.strandLabels[0,0]._text = 'zero'
    sp.strandLabels[1,0]._text = 'Earth'
    sp.strandLabels[2,2]._text = 'Mars'
    sp.strandLabels.format = 'values'
    sp.strandLabels.dR = -5
    d.add(sp)
    return d
开发者ID:makinacorpus,项目名称:reportlab-ecomobile,代码行数:31,代码来源:spider.py


示例13: line_plot

def line_plot(data, elements):
    drawing = Drawing(0, 400)  # for indices
    lp = LinePlot()
    lp.x = 0
    lp.y = 50
    lp.height = 300
    lp.width = 600
    lp.data = data
    lp.joinedLines = 1
    lp.lines[0].symbol = makeMarker('FilledCircle')
    lp.lines[1].symbol = makeMarker('Circle')
    lp.lineLabelFormat = '%2.0f'
    lp.strokeColor = colors.black
    lp.xValueAxis.valueMin = 0
    lp.xValueAxis.valueMax = 5
    lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
    lp.xValueAxis.labelTextFormat = '%2.1f'
    lp.yValueAxis.valueMin = 0
    lp.yValueAxis.valueMax = 7
    lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]
    drawing.add(lp)
    elements.append(drawing)
开发者ID:prakhar987,项目名称:PDF-Generator-SSAD-Project,代码行数:22,代码来源:views.py


示例14: __init__

    def __init__(self, chart, data_dict, width=600, height=450,
                 colorscheme='color'):
        """ Initialize the basic graphing class.
            Set the chart, data, width, height and color scheme.
        """
        self._data_dict = data_dict
        Drawing.__init__(self, width, height)
        self.add(chart, name='_linechart')
        self._linechart.width = 900
        self._linechart.height = 240
        self._linechart.x = 50
        self._linechart.y = 80

        self._linechart.joinedLines = 1
        self._linechart.categoryAxis.categoryNames = self.getCategories()
        self._linechart.categoryAxis.labels.boxAnchor = 'n'
        self._linechart.valueAxis.valueMin = 0
        self._linechart.valueAxis.valueMax = self.getHighestScore()
        self._linechart.valueAxis.valueStep = 1
        self._linechart.lines[0].strokeWidth = 2
        self._linechart.lines[1].strokeWidth = 1.5
        self._linechart.lines[0].strokeDashArray=3,4
        self._linechart.lines[0].strokeColor = colors.green
        self._linechart.lines[1].strokeColor = colors.red
        self._linechart.lines[1].symbol = makeMarker('Cross')
        self._linechart.lines[0].symbol = makeMarker('Cross')

        # calculate a sane y-axis interval
        valuestep = self.getHighestScore() / 10
        if valuestep <= 1:
            self._linechart.valueAxis.valueStep = 1
        else:
            self._linechart.valueAxis.valueStep = valuestep

        self.setTitle()
        self._linechart.data = self.getChartData()
开发者ID:upfrontsystems,项目名称:tarmii.theme,代码行数:36,代码来源:charts.py


示例15: line_chart_draw

 def line_chart_draw(self, values, days):
     nr_days = len(days)
     min_temp = min(min(values[0]), min(values[1]))
     d = Drawing(0, 170)
     # draw line chart
     chart = SampleHorizontalLineChart()
     # set width and height
     chart.width = 350
     chart.height = 135
     # set data values
     chart.data = values
     # use(True) or not(False) line between points
     chart.joinedLines = True
     # set font desired
     chart.lineLabels.fontName = 'FreeSans'
     # set color for the plot area border and interior area
     chart.strokeColor = colors.white
     chart.fillColor = colors.lightblue
     # set lines color and width
     chart.lines[0].strokeColor = colors.red
     chart.lines[0].strokeWidth = 2
     chart.lines[1].strokeColor = colors.blue
     chart.lines[1].strokeWidth = 2
     # set symbol for points
     chart.lines.symbol = makeMarker('Square')
     # set format for points from chart
     chart.lineLabelFormat = '%2.0f'
     # for negative axes intersect should be under zero
     chart.categoryAxis.joinAxisMode = 'bottom'
     # set font used for axes
     chart.categoryAxis.labels.fontName = 'FreeSans'
     if nr_days > 7:
         chart.categoryAxis.labels.angle = 45
         chart.categoryAxis.labels.boxAnchor = 'e'
     chart.categoryAxis.categoryNames = days
     # change y axe format
     chart.valueAxis.labelTextFormat = '%2.0f °C'
     chart.valueAxis.valueStep = 10
     if min_temp > 0:
         chart.valueAxis.valueMin = 0
     llabels = ['Max temp', 'Min temp']
     d.add(self.title_draw(250, 180, _('Temperatures statistics')))
     d.add(chart)
     d.add(self.legend_draw(llabels, chart, x=400, y=150, type='line'))
     return d
开发者ID:Cuahutli,项目名称:python-django-exporting-files,代码行数:45,代码来源:pdf_utils.py


示例16: demo

    def demo(self):
        """Shows basic use of a line chart."""

        drawing = Drawing(200, 100)

        data = [(13, 5, 20, 22, 37, 45, 19, 4), (14, 10, 21, 28, 38, 46, 25, 5)]

        lc = HorizontalLineChart()

        lc.x = 20
        lc.y = 10
        lc.height = 85
        lc.width = 170
        lc.data = data
        lc.lines.symbol = makeMarker("Circle")

        drawing.add(lc)

        return drawing
开发者ID:Nuevosmedios,项目名称:quicklearn-env,代码行数:19,代码来源:linecharts.py


示例17: test_23_linePlotCharts

    def test_23_linePlotCharts(self):
        from reportlab.lib.styles import getSampleStyleSheet
        from reportlab.lib import colors
        from reportlab.lib.units import inch
        from reportlab.platypus import SimpleDocTemplate, Spacer, Paragraph
        from reportlab.pdfbase import pdfmetrics
        from reportlab.graphics.shapes import Drawing
        from reportlab.pdfbase.ttfonts import TTFont
        from reportlab.graphics.charts.lineplots import LinePlot
        from reportlab.graphics.widgets.markers import makeMarker

        pdfmetrics.registerFont(TTFont('chsFont', 'STHeiti Light.ttc'))
        stylesheet = getSampleStyleSheet()

        elements = []
        doc = SimpleDocTemplate("demo.pdf")

        elements.append(Paragraph('<font name="chsFont">JY.zenist.song - 俊毅</font>', stylesheet['Title']))
        elements.append(Spacer(1,1*inch))

        d = Drawing(400,200)
        data = [
            [(1,1), (2,2), (2.5,1), (3,3), (4,5)],
        ]
        lp = LinePlot()
        lp.x = 5
        lp.y = 5
        lp.height = 190
        lp.width = 390
        lp.data = data
        lp.joinedLines = 1
        lp.lines[0].symbol = makeMarker('FilledCircle')
        d.add(lp)

        elements.append(d)

        doc.build(elements)
开发者ID:zenist,项目名称:ZLib,代码行数:37,代码来源:test_pdf.py


示例18: draw

    def draw(self):
        # normalize slice data
        g = self.makeBackground() or Group()

        xradius = self.width/2.0
        yradius = self.height/2.0
        self._radius = radius = min(xradius, yradius)
        cx = self.x + xradius
        cy = self.y + yradius

        data = self.normalizeData()

        self._seriesCount = len(data)
        n = len(data[0])

        #labels
        if self.labels is None:
            labels = [''] * n
        else:
            labels = self.labels
            #there's no point in raising errors for less than enough errors if
            #we silently create all for the extreme case of no labels.
            i = n-len(labels)
            if i>0:
                labels = labels + ['']*i

        S = []
        STRANDS = []
        STRANDAREAS = []
        syms = []
        labs = []
        csa = []
        angle = self.startAngle*pi/180
        direction = self.direction == "clockwise" and -1 or 1
        angleBetween = direction*(2 * pi)/float(n)
        spokes = self.spokes
        spokeLabels = self.spokeLabels
        for i in xrange(n):
            car = cos(angle)*radius
            sar = sin(angle)*radius
            csa.append((car,sar,angle))
            si = self.spokes[i]
            if si.visible:
                spoke = Line(cx, cy, cx + car, cy + sar, strokeWidth = si.strokeWidth, strokeColor=si.strokeColor, strokeDashArray=si.strokeDashArray)
            S.append(spoke)
            sli = spokeLabels[i]
            text = sli._text
            if not text: text = labels[i]
            if text:
                S.append(_setupLabel(WedgeLabel, text, si.labelRadius, cx, cy, angle, car, sar, sli))
            angle += angleBetween

        # now plot the polygons
        rowIdx = 0
        strands = self.strands
        strandLabels = self.strandLabels
        for row in data:
            # series plot
            rsty = strands[rowIdx]
            points = []
            car, sar = csa[-1][:2]
            r = row[-1]
            points.append(cx+car*r)
            points.append(cy+sar*r)
            for i in xrange(n):
                car, sar, angle = csa[i]
                r = row[i]
                points.append(cx+car*r)
                points.append(cy+sar*r)
                L = self._innerDrawLabel(strandLabels[(rowIdx,i)], r, cx, cy, angle, car, sar, labelClass=StrandLabel)
                if L: labs.append(L)
                sty = strands[(rowIdx,i)]
                uSymbol = sty.symbol

                # put in a marker, if it needs one
                if uSymbol:
                    s_x =  cx+car*r
                    s_y = cy+sar*r
                    s_fillColor = sty.fillColor
                    s_strokeColor = sty.strokeColor
                    s_strokeWidth = sty.strokeWidth
                    s_angle = 0
                    s_size = sty.symbolSize
                    if type(uSymbol) is type(''):
                        symbol = makeMarker(uSymbol,
                                    size = s_size,
                                    x =  s_x,
                                    y = s_y,
                                    fillColor = s_fillColor,
                                    strokeColor = s_strokeColor,
                                    strokeWidth = s_strokeWidth,
                                    angle = s_angle,
                                    )
                    else:
                        symbol = uSymbol2Symbol(uSymbol,s_x,s_y,s_fillColor)
                        for k,v in (('size', s_size), ('fillColor', s_fillColor),
                                    ('x', s_x), ('y', s_y),
                                    ('strokeColor',s_strokeColor), ('strokeWidth',s_strokeWidth),
                                    ('angle',s_angle),):
                            if getattr(symbol,k,None) is None:
#.........这里部分代码省略.........
开发者ID:makinacorpus,项目名称:reportlab-ecomobile,代码行数:101,代码来源:spider.py


示例19: draw


#.........这里部分代码省略.........
                    labelRadius = si.labelRadius
                    L = WedgeLabel()
                    L.x = centerx + labelRadius*car
                    L.y = centery + labelRadius*sar
                    L.boxAnchor = si.label_boxAnchor
                    L._pmv = angle*180/pi
                    L.dx = si.label_dx
                    L.dy = si.label_dy
                    L.angle = si.label_angle
                    L.boxAnchor = si.label_boxAnchor
                    L.boxStrokeColor = si.label_boxStrokeColor
                    L.boxStrokeWidth = si.label_boxStrokeWidth
                    L.boxFillColor = si.label_boxFillColor
                    L.strokeColor = si.label_strokeColor
                    L.strokeWidth = si.label_strokeWidth
                    L._text = text
                    L.leading = si.label_leading
                    L.width = si.label_width
                    L.maxWidth = si.label_maxWidth
                    L.height = si.label_height
                    L.textAnchor = si.label_textAnchor
                    L.visible = si.label_visible
                    L.topPadding = si.label_topPadding
                    L.leftPadding = si.label_leftPadding
                    L.rightPadding = si.label_rightPadding
                    L.bottomPadding = si.label_bottomPadding
                    L.fontName = si.fontName
                    L.fontSize = si.fontSize
                    L.fillColor = si.fontColor
                    spokes.append(L)
            angle = angle + angleBetween

        # now plot the polygons

        rowIdx = 0
        for row in data:
            # series plot
            points = []
            car, sar = csa[-1][:2]
            r = row[-1]
            points.append(centerx+car*r)
            points.append(centery+sar*r)
            for i in xrange(n):
                car, sar = csa[i][:2]
                r = row[i]
                points.append(centerx+car*r)
                points.append(centery+sar*r)

                # make up the 'strand'
                strand = Polygon(points)
                strand.fillColor = self.strands[rowIdx].fillColor
                strand.strokeColor = self.strands[rowIdx].strokeColor
                strand.strokeWidth = self.strands[rowIdx].strokeWidth
                strand.strokeDashArray = self.strands[rowIdx].strokeDashArray

                g.add(strand)

                # put in a marker, if it needs one
                if markers:
                    if hasattr(self.strands[rowIdx], 'markerType'):
                        uSymbol = self.strands[rowIdx].markerType
                    elif hasattr(self.strands, 'markerType'):
                        uSymbol = self.strands.markerType
                    else:
                        uSymbol = None
                    m_x =  centerx+car*r
                    m_y = centery+sar*r
                    m_size = self.strands[rowIdx].markerSize
                    m_fillColor = self.strands[rowIdx].fillColor
                    m_strokeColor = self.strands[rowIdx].strokeColor
                    m_strokeWidth = self.strands[rowIdx].strokeWidth
                    m_angle = 0
                    if type(uSymbol) is type(''):
                        symbol = makeMarker(uSymbol,
                                    size = m_size,
                                    x =  m_x,
                                    y = m_y,
                                    fillColor = m_fillColor,
                                    strokeColor = m_strokeColor,
                                    strokeWidth = m_strokeWidth,
                                    angle = m_angle,
                                    )
                    else:
                        symbol = uSymbol2Symbol(uSymbol,m_x,m_y,m_fillColor)
                        for k,v in (('size', m_size), ('fillColor', m_fillColor),
                                    ('x', m_x), ('y', m_y),
                                    ('strokeColor',m_strokeColor), ('strokeWidth',m_strokeWidth),
                                    ('angle',m_angle),):
                            try:
                                setattr(uSymbol,k,v)
                            except:
                                pass
                    g.add(symbol)

            rowIdx = rowIdx + 1

        # spokes go over strands
        for spoke in spokes:
            g.add(spoke)
        return g
开发者ID:tschalch,项目名称:pyTray,代码行数:101,代码来源:spider.py


示例20: __init__

    def __init__(self):
        LinePlot.__init__(self)
        self.width = 142
        self.height = 77
        self.outerBorderOn = 1
        self.outerBorderColor = colors.black
        self.background = None

        _labelOffset = 3
        _axisTickLengths = 2
        _axisStrokeWidth = 0.5

        self.yValueAxis.valueMin = None
        self.yValueAxis.valueMax = None
        self.yValueAxis.valueStep = None
        self.yValueAxis.labelTextFormat  = '%s'

        self.xLabel="X Lable"
        self.xValueAxis.labels.fontSize = 6

        self.yLabel="Y Lable"
        self.yValueAxis.labels.fontSize = 6

        self.data =[((0.030, 62.73),
                     (0.074, 54.363),
                     (1.216, 17.964)),

                     ((1.360, 11.621),
                     (1.387, 50.011),
                     (1.428, 68.953)),

                     ((1.444, 86.888),
                     (1.754, 35.58),
                     (1.766, 36.05))]

        #values for lineplot
        self.joinedLines = 0
        self.fillColor = self.background

        self.leftPadding=5
        self.rightPadding=10
        self.topPadding=5
        self.bottomPadding=5

        self.x = self.leftPadding+_axisTickLengths+(_labelOffset*2)
        self.x=self.x+_maxWidth(str(self.yValueAxis.valueMax), self.yValueAxis.labels.fontName, self.yValueAxis.labels.fontSize)
        self.y = self.bottomPadding+_axisTickLengths+_labelOffset+self.xValueAxis.labels.fontSize

        self.xValueAxis.labels.dy = -_labelOffset
        self.xValueAxis.tickDown = _axisTickLengths
        self.xValueAxis.strokeWidth = _axisStrokeWidth
        self.xValueAxis.rangeRound='both'
        self.yValueAxis.labels.dx = -_labelOffset
        self.yValueAxis.tickLeft = _axisTickLengths
        self.yValueAxis.strokeWidth = _axisStrokeWidth
        self.yValueAxis.rangeRound='both'

        self.lineLabelFormat="%.2f"
        self.lineLabels.fontSize = 5
        self.lineLabels.boxAnchor = 'e'
        self.lineLabels.dx             = -2
        self.lineLabelNudge = 0
        self.lines.symbol=makeMarker('FilledCircle',size=3)
        self.lines[1].symbol=makeMarker('FilledDiamond',size=3)
        self.lines[2].symbol=makeMarker('FilledSquare',size=3)
        self.lines[2].strokeColor = colors.green
开发者ID:SongJLG,项目名称:johan-doc,代码行数:66,代码来源:lineplots.py



注:本文中的reportlab.graphics.widgets.markers.makeMarker函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python markers.uSymbol2Symbol函数代码示例发布时间:2022-05-26
下一篇:
Python shapes.Wedge类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap