def interpolation(): width, height = 600, 400 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))) svgs = [] for interpolation in 'quadratic', 'cubic', 'lagrange', 'trigonometric': config.title = "%s interpolation" % interpolation config.interpolate = interpolation svgs.append({ 'type': 'pygal.StackedLine', 'series': series, 'config': b64encode(pickle.dumps(config)) }) for params in [{'type': 'catmull_rom'}, {'type': 'finite_difference'}, {'type': 'cardinal', 'c': .25}, {'type': 'cardinal', 'c': .5}, {'type': 'cardinal', 'c': .75}, {'type': 'cardinal', 'c': 1.5}, {'type': 'cardinal', 'c': 2}, {'type': 'cardinal', 'c': 5}, {'type': 'kochanek_bartels', 'b': 1, 'c': 1, 't': 1}, {'type': 'kochanek_bartels', 'b': -1, 'c': 1, 't': 1}, {'type': 'kochanek_bartels', 'b': 1, 'c': -1, 't': 1}, {'type': 'kochanek_bartels', 'b': 1, 'c': 1, 't': -1}, { 'type': 'kochanek_bartels', 'b': -1, 'c': 1, 't': -1 }, {'type': 'kochanek_bartels', 'b': -1, 'c': -1, 't': 1}, {'type': 'kochanek_bartels', 'b': -1, 'c': -1, 't': -1}]: config.title = "Hermite interpolation with params %r" % params config.interpolate = 'hermite' config.interpolation_parameters = params svgs.append({ 'type': 'pygal.StackedLine', 'series': series, 'config': b64encode(pickle.dumps(config)) }) return render_template( 'svgs.jinja2', svgs=svgs, width=width, height=height )
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)
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)
def interpolation(): width, height = 600, 400 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))) svgs = [] for interpolation in ('linear', 'slinear', 'nearest', 'zero', 'quadratic', 'cubic', 'krogh', 'barycentric', 'univariate', 4, 5, 6, 7, 8): config.title = "%s interpolation" % interpolation config.interpolate = interpolation svgs.append({ 'type': 'StackedLine', 'series': series, 'config': b64encode(pickle.dumps(config)) }) return render_template('svgs.jinja2', svgs=svgs, width=width, height=height)
def interpolation(): width, height = 600, 400 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))) svgs = [] for interpolation in 'quadratic', 'cubic', 'lagrange', 'trigonometric': config.title = "%s interpolation" % interpolation config.interpolate = interpolation svgs.append({'type': 'StackedLine', 'series': series, 'config': b64encode(pickle.dumps(config))}) for params in [ {'type': 'catmull_rom'}, {'type': 'finite_difference'}, {'type': 'cardinal', 'c': .25}, {'type': 'cardinal', 'c': .5}, {'type': 'cardinal', 'c': .75}, {'type': 'cardinal', 'c': 1.5}, {'type': 'cardinal', 'c': 2}, {'type': 'cardinal', 'c': 5}, {'type': 'kochanek_bartels', 'b': 1, 'c': 1, 't': 1}, {'type': 'kochanek_bartels', 'b': -1, 'c': 1, 't': 1}, {'type': 'kochanek_bartels', 'b': 1, 'c': -1, 't': 1}, {'type': 'kochanek_bartels', 'b': 1, 'c': 1, 't': -1}, {'type': 'kochanek_bartels', 'b': -1, 'c': 1, 't': -1}, {'type': 'kochanek_bartels', 'b': -1, 'c': -1, 't': 1}, {'type': 'kochanek_bartels', 'b': -1, 'c': -1, 't': -1} ]: config.title = "Hermite interpolation with params %r" % params config.interpolate = 'hermite' config.interpolation_parameters = params svgs.append({'type': 'StackedLine', 'series': series, 'config': b64encode(pickle.dumps(config))}) return render_template('svgs.jinja2', svgs=svgs, width=width, height=height)
def interpolation(): width, height = 600, 400 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))) svgs = [] for interpolation in "quadratic", "cubic", "lagrange", "trigonometric": config.title = "%s interpolation" % interpolation config.interpolate = interpolation svgs.append({"type": "StackedLine", "series": series, "config": b64encode(pickle.dumps(config))}) for params in [ {"type": "catmull_rom"}, {"type": "finite_difference"}, {"type": "cardinal", "c": 0.25}, {"type": "cardinal", "c": 0.5}, {"type": "cardinal", "c": 0.75}, {"type": "cardinal", "c": 1.5}, {"type": "cardinal", "c": 2}, {"type": "cardinal", "c": 5}, {"type": "kochanek_bartels", "b": 1, "c": 1, "t": 1}, {"type": "kochanek_bartels", "b": -1, "c": 1, "t": 1}, {"type": "kochanek_bartels", "b": 1, "c": -1, "t": 1}, {"type": "kochanek_bartels", "b": 1, "c": 1, "t": -1}, {"type": "kochanek_bartels", "b": -1, "c": 1, "t": -1}, {"type": "kochanek_bartels", "b": -1, "c": -1, "t": 1}, {"type": "kochanek_bartels", "b": -1, "c": -1, "t": -1}, ]: config.title = "Hermite interpolation with params %r" % params config.interpolate = "hermite" config.interpolation_parameters = params svgs.append({"type": "StackedLine", "series": series, "config": b64encode(pickle.dumps(config))}) return render_template("svgs.jinja2", svgs=svgs, width=width, height=height)
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)
def interpolation(): width, height = 600, 400 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))) svgs = [] for interpolation in ( 'linear', 'slinear', 'nearest', 'zero', 'quadratic', 'cubic', 'krogh', 'barycentric', 'univariate', 4, 5, 6, 7, 8): config.title = "%s interpolation" % interpolation config.interpolate = interpolation svgs.append({'type': 'StackedLine', 'series': series, 'config': b64encode(pickle.dumps(config))}) return render_template('svgs.jinja2', svgs=svgs, width=width, height=height)