def test_line_charts():
    import cartesius.colors as colors

    coordinate_system = cartesius.CoordinateSystem()

    # linechart (that mimic function chart) with generator and colors computed on the fly:
    def f():
        from_color = (255, 255, 0)
        to_color = (100, 100, 255)
        i = -2
        while i < 6:
            value = 2 * math.sin(i)
            color = colors.get_color_between(from_color, to_color, (value + 2)/4.)
            yield charts.data(i, value, fill_color=color, color=(0, 0, 0))
            i += .05

    coordinate_system.add(
            charts.LineChart(
                    data = f,
                    transparency_mask = 0))

    # filled line chart with labels
    coordinate_system.add(
            charts.LineChart(
                    data = (charts.data(-2, 1, label='aaa'), 
                            charts.data(0, -1, label='bbb'), 
                            charts.data(3, 1.2), 
                            charts.data(7, 1.2)),
                    fill_color = (50, 50, 50),
                    transparency_mask = 50))

    # normal line chart with labels:
    coordinate_system.add(
            charts.LineChart(
                    data = (charts.data(0, 0), 
                            charts.data(1, -3), 
                            charts.data(4, 3, label='aaa', label_position=cartesius.CENTER_DOWN), 
                            charts.data(5, -2, label='custom label', label_position=cartesius.RIGHT_CENTER), 
                            charts.data(7, 0)),
                    color = (255, 0, 0),
                    transparency_mask = 150))

    return coordinate_system.draw(300, 200), coordinate_system.draw(300, 200, antialiasing=True)
Line charts
dataset/ETHPy150Open tkrajina/cartesius/create_images_and_readme.py/test_line_charts