[reportlab-users] implementing new chart type

Robin Becker reportlab-users@reportlab.com
Wed, 16 Oct 2002 14:01:24 +0100


In article <2233.28.1.42.67.1034768674.squirrel@web03.rasselstein-hoesch.de>, Ingo Graser <ingo.graser@tks-
rasselstein.thyssenkrupp.com> writes
>Hi.
>
>I am in need of a "polar chart" type in reportlab. I am about to implement
>this chart from the ground up.
>
>Are there any descriptions of how the chart-classes work ?
>What is a good point to start ? Do somewhere exist a kind of basic class
>for charts without the mass of code as in e.g. barchart.py ?
>
>
>Thank you,
>Ingo Graser

I would start by inheriting from PlotArea

class PolarPlot(PlotArea):
        _attrMap = AttrMap(BASE=PlotArea,
                origin = AttrMapValue(isXYCoord, desc='Origin of the plot'),
                data = AttrMapValue(None, desc='Data to be plotted, list of (lists of) numbers.'),
                )

        def __init__(self):
                PlotArea.__init__(self)
                self.data = [(100,110,120,130),(70, 80, 85, 90)]
                self.origin = (self.width/2.,self.height/2)

        def demo(self):
                drawing = Drawing(200, 100)
                bc = self.__class__()
                drawing.add(bc)
                return drawing

        def draw(self):
                bg = self.makeBackground()
                g = Group()
                .....#add things to g
                g.add(bg)
                return g
-- 
Robin Becker