Exemplo n.º 1
0
    def rotation():
        width, height = 375, 245
        config = Config()
        config.width = width
        config.height = height
        config.fill = True
        config.style = styles['neon']
        data = random.randrange(1, 10)
        order = random.randrange(1, 10)
        series = b64encode(pickle.dumps(_random_series(type, data, order)))
        labels = [random_label() for i in range(data)]
        svgs = []
        config.show_legend = bool(random.randrange(0, 2))
        for angle in range(0, 91, 5):
            config.title = "%d rotation" % angle
            config.x_labels = labels
            config.x_label_rotation = angle
            svgs.append({'type': 'Bar',
                         'series': series,
                         'config': b64encode(pickle.dumps(config))})

        return render_template('svgs.jinja2',
                               svgs=svgs,
                               width=width,
                               height=height)
Exemplo n.º 2
0
    def rotation():
        width, height = 375, 245
        config = Config()
        config.width = width
        config.height = height
        config.fill = True
        config.style = styles['neon']
        data = random.randrange(1, 10)
        order = random.randrange(1, 10)
        series = b64encode(pickle.dumps(_random_series(type, data, order)))
        labels = [random_label() for i in range(data)]
        svgs = []
        config.show_legend = bool(random.randrange(0, 2))
        for angle in range(0, 370, 10):
            config.title = "%d rotation" % angle
            config.x_labels = labels
            config.x_label_rotation = angle
            config.y_label_rotation = angle
            svgs.append({'type': 'pygal.Bar',
                         'series': series,
                         'config': b64encode(pickle.dumps(config))})

        return render_template('svgs.jinja2',
                               svgs=svgs,
                               width=width,
                               height=height)
Exemplo n.º 3
0
    def all(style='default', color=None, interpolate=None, base_style=None):
        width, height = 600, 400
        data = random.randrange(1, 10)
        order = random.randrange(1, 10)
        if color is None:
            style = styles[style]
        else:
            style = parametric_styles[style](
                color, base_style=styles[base_style or 'default'])
        xy_series = _random(data, order)
        other_series = []
        for title, values in xy_series:
            other_series.append(
                (title, cut(values, 1)))
        xy_series = b64encode(pickle.dumps(xy_series))
        other_series = b64encode(pickle.dumps(other_series))
        config = Config()
        config.width = width
        config.height = height
        config.fill = bool(random.randrange(0, 2))
        config.human_readable = True
        config.interpolate = interpolate
        config.style = style
        config.x_labels = [random_label() for i in range(data)]
        svgs = []
        for chart in pygal.CHARTS:
            type = chart.__name__
            svgs.append({'type': type,
                         'series': xy_series if type == 'XY' else other_series,
                         'config': b64encode(pickle.dumps(config))})

        return render_template('svgs.jinja2',
                               svgs=svgs,
                               width=width,
                               height=height)
Exemplo n.º 4
0
    def all(style='default', interpolate=None):
        width, height = 600, 400
        data = random.randrange(1, 10)
        order = random.randrange(1, 10)
        xy_series = _random(data, order)
        other_series = []
        for title, values in xy_series:
            other_series.append((title, cut(values, 1)))
        xy_series = b64encode(pickle.dumps(xy_series))
        other_series = b64encode(pickle.dumps(other_series))
        config = Config()
        config.width = width
        config.height = height
        config.fill = bool(random.randrange(0, 2))
        config.human_readable = True
        config.interpolate = interpolate
        config.style = styles[style]
        config.x_labels = [random_label() for i in range(data)]
        svgs = []
        for chart in pygal.CHARTS:
            type = chart.__name__
            svgs.append({
                'type': type,
                'series': xy_series if type == 'XY' else other_series,
                'config': b64encode(pickle.dumps(config))
            })

        return render_template('svgs.jinja2',
                               svgs=svgs,
                               width=width,
                               height=height)
Exemplo n.º 5
0
    def all(style='default', color=None, interpolate=None, base_style=None):
        width, height = 600, 400
        data = random.randrange(1, 10)
        order = random.randrange(1, 10)
        if color is None:
            style = styles[style]
        else:
            style = parametric_styles[style](color,
                                             base_style=styles[base_style
                                                               or 'default'])

        xy_series = _random(data, order)
        other_series = []
        for title, values, config in xy_series:
            other_series.append((title, cut(values, 1), config))
        xy_series = b64encode(pickle.dumps(xy_series))
        other_series = b64encode(pickle.dumps(other_series))
        config = Config()
        config.width = width
        config.height = height
        config.fill = bool(random.randrange(0, 2))
        config.interpolate = interpolate
        config.style = style
        svgs = []
        for chart in pygal.CHARTS:
            type = '.'.join((chart.__module__, chart.__name__))
            if chart._dual:
                config.x_labels = None
            else:
                config.x_labels = [random_label() for i in range(data)]
            svgs.append({
                'type': type,
                'series': xy_series if chart._dual else other_series,
                'config': b64encode(pickle.dumps(config))
            })

        return render_template('svgs.jinja2',
                               svgs=svgs,
                               width=width,
                               height=height)
Exemplo n.º 6
0
    def all(style="default", color=None, interpolate=None, base_style=None):
        width, height = 600, 400
        data = random.randrange(1, 10)
        order = random.randrange(1, 10)
        if color is None:
            style = styles[style]
        else:
            style = parametric_styles[style](color, base_style=styles[base_style or "default"])

        xy_series = _random(data, order)
        other_series = []
        for title, values, config in xy_series:
            other_series.append((title, cut(values, 1), config))
        xy_series = b64encode(pickle.dumps(xy_series))
        other_series = b64encode(pickle.dumps(other_series))
        config = Config()
        config.width = width
        config.height = height
        config.fill = bool(random.randrange(0, 2))
        config.interpolate = interpolate
        config.style = style
        svgs = []
        for chart in pygal.CHARTS:
            type = ".".join((chart.__module__, chart.__name__))
            if chart._dual:
                config.x_labels = None
            else:
                config.x_labels = [random_label() for i in range(data)]
            svgs.append(
                {
                    "type": type,
                    "series": xy_series if chart._dual else other_series,
                    "config": b64encode(pickle.dumps(config)),
                }
            )

        return render_template("svgs.jinja2", svgs=svgs, width=width, height=height)
Exemplo n.º 7
0
    def rotation():
        width, height = 375, 245
        config = Config()
        config.width = width
        config.height = height
        config.fill = True
        config.style = styles["neon"]
        data = random.randrange(1, 10)
        order = random.randrange(1, 10)
        series = b64encode(pickle.dumps(_random_series(type, data, order)))
        labels = [random_label() for i in range(data)]
        svgs = []
        config.show_legend = bool(random.randrange(0, 2))
        for angle in range(0, 370, 10):
            config.title = "%d rotation" % angle
            config.x_labels = labels
            config.x_label_rotation = angle
            config.y_label_rotation = angle
            svgs.append({"type": "pygal.Bar", "series": series, "config": b64encode(pickle.dumps(config))})

        return render_template("svgs.jinja2", svgs=svgs, width=width, height=height)