Example #1
0
 def test_long_labels():
     bar = Bar()
     bar.add("Long", [2, None, 12])
     bar.title = "1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890"
     bar.x_labels = "a" * 100, "b " * 50, "cc ! " * 20
     bar.x_label_rotation = 45
     return bar.render_response()
Example #2
0
    def test_bar_links():
        bar = Bar(style=styles['neon'])
        bar.js = ('http://l:2343/svg.jquery.js',
                  'http://l:2343/pygal-tooltips.js')
        bar.add('1234', [
            {'value': 10,
             'label': 'Ten',
             'xlink': 'http://google.com?q=10'},
            {'value': 20,
             'tooltip': 'Twenty',
             'xlink': 'http://google.com?q=20'},
            30,
            {'value': 40,
             'label': 'Forty',
             'xlink': 'http://google.com?q=40'}
        ])

        bar.add('4321', [40, {
            'value': 30,
            'label': 'Thirty',
            'xlink': 'http://google.com?q=30'
        }, 20, 10])
        bar.x_labels = map(str, range(1, 5))
        bar.logarithmic = True
        bar.zero = 1
        return bar.render_response()
Example #3
0
    def test_bar_links():
        bar = Bar(style=styles['neon'])
        bar.js = ('http://l:2343/svg.jquery.js',
                  'http://l:2343/pygal-tooltips.js')
        bar.add('1234', [{
            'value': 10,
            'label': 'Ten',
            'xlink': 'http://google.com?q=10'
        }, {
            'value': 20,
            'tooltip': 'Twenty',
            'xlink': 'http://google.com?q=20'
        }, 30, {
            'value': 40,
            'label': 'Forty',
            'xlink': 'http://google.com?q=40'
        }])

        bar.add('4321', [
            40, {
                'value': 30,
                'label': 'Thirty',
                'xlink': 'http://google.com?q=30'
            }, 20, 10
        ])
        bar.x_labels = map(str, range(1, 5))
        bar.logarithmic = True
        bar.zero = 1
        return bar.render_response()
Example #4
0
 def test_multiline_title():
     bar = Bar()
     bar.add('Looooooooooooooooooooooooooooooooooong', [2, None, 12])
     bar.title = (
         'First line \n Second line \n Third line'
     )
     return bar.render_response()
Example #5
0
 def test_multiline_title():
     bar = Bar()
     bar.add('Looooooooooooooooooooooooooooooooooong', [2, None, 12])
     bar.title = (
         'First line \n Second line \n Third line'
     )
     return bar.render_response()
Example #6
0
File: tests.py Project: Kozea/pygal
 def test_bar():
     bar = Bar(dynamic_print_values=True, show_minor_x_labels=False)
     bar.add('1', [1, 2, 3])
     bar.add('2', [4, 5, 6])
     bar.x_labels = [2, 4, 6]
     bar.x_labels_major = [4]
     return bar.render_response()
Example #7
0
 def test_bar():
     bar = Bar(dynamic_print_values=True, show_minor_x_labels=False)
     bar.add('1', [1, 2, 3])
     bar.add('2', [4, 5, 6])
     bar.x_labels = [2, 4, 6]
     bar.x_labels_major = [4]
     return bar.render_response()
Example #8
0
 def test_long_labels():
     bar = Bar()
     bar.add('Long', [2, None, 12])
     bar.title = (
         '1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890')
     bar.x_labels = 'a' * 100, 'b ' * 50, 'cc ! ' * 20
     bar.x_label_rotation = 45
     return bar.render_response()
Example #9
0
 def test_long_labels():
     bar = Bar()
     bar.add('Long', [2, None, 12])
     bar.title = (
         '1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890')
     bar.x_labels = 'a' * 100, 'b ' * 50, 'cc ! ' * 20
     bar.x_label_rotation = 45
     return bar.render_response()
Example #10
0
 def test_unsorted():
     bar = Bar(style=styles["neon"], human_readable=True)
     bar.add("A", {"red": 10, "green": 12, "blue": 14})
     bar.add("B", {"green": 11, "blue": 7})
     bar.add("C", {"blue": 7})
     bar.add("D", {})
     bar.add("E", {"blue": 2, "red": 13})
     bar.x_labels = ("red", "green", "blue")
     return bar.render_response()
Example #11
0
 def test_unsorted():
     bar = Bar(style=styles['neon'])
     bar.add('A', {'red': 10, 'green': 12, 'blue': 14})
     bar.add('B', {'green': 11, 'blue': 7})
     bar.add('C', {'blue': 7})
     bar.add('D', {})
     bar.add('E', {'blue': 2, 'red': 13})
     bar.x_labels = ('red', 'green', 'blue')
     return bar.render_response()
Example #12
0
 def test_unsorted():
     bar = Bar(style=styles['neon'])
     bar.add('A', {'red': 10, 'green': 12, 'blue': 14})
     bar.add('B', {'green': 11, 'blue': 7})
     bar.add('C', {'blue': 7})
     bar.add('D', {})
     bar.add('E', {'blue': 2, 'red': 13})
     bar.x_labels = ('red', 'green', 'blue')
     return bar.render_response()
Example #13
0
 def test_bar_print_values():
     bar = Bar(print_values=True, js=[],
               style=styles['default'](
                   value_font_family='googlefont:Raleway',
                   value_font_size=30,
                   value_colors=(None, None, 'blue', 'red', 'green')
               ))
     for i in range(12):
         bar.add('', i)
     return bar.render_response()
Example #14
0
 def test_long_title():
     bar = Bar()
     bar.add('Looooooooooooooooooooooooooooooooooong', [2, None, 12])
     bar.title = (
         '1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 '
         '12345678901 123456789012 1234567890123 12345678901234 '
         '123456789012345 1234567890123456 12345678901234567 '
         '123456789012345678 1234567890123456789 12345678901234567890 '
         '123456789012345 1234567890123456 12345678901234567 '
         '12345678901 123456789012 1234567890123 12345678901234 '
         '1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890')
     return bar.render_response()
Example #15
0
 def test_long_title():
     bar = Bar()
     bar.add('Looooooooooooooooooooooooooooooooooong', [2, None, 12])
     bar.title = (
         '1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 '
         '12345678901 123456789012 1234567890123 12345678901234 '
         '123456789012345 1234567890123456 12345678901234567 '
         '123456789012345678 1234567890123456789 12345678901234567890 '
         '123456789012345 1234567890123456 12345678901234567 '
         '12345678901 123456789012 1234567890123 12345678901234 '
         '1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890')
     return bar.render_response()
Example #16
0
 def test_ylabels():
     chart = Bar()
     chart.x_labels = "Red", "Blue", "Green"
     chart.y_labels = [
         {"value": 0.0001, "label": "LOL"},
         {"value": 0.0003, "label": "ROFL"},
         {"value": 0.0004, "label": "MAO"},
         {"value": 0.00045, "label": "LMFAO"},
         {"value": 0.0005, "label": "GMCB"},
     ]
     chart.add("line", [0.0002, 0.0005, 0.00035])
     return chart.render_response()
Example #17
0
 def test_long_title():
     bar = Bar()
     bar.add("Looooooooooooooooooooooooooooooooooong", [2, None, 12])
     bar.title = (
         "1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 "
         "12345678901 123456789012 1234567890123 12345678901234 "
         "123456789012345 1234567890123456 12345678901234567 "
         "123456789012345678 1234567890123456789 12345678901234567890 "
         "123456789012345 1234567890123456 12345678901234567 "
         "12345678901 123456789012 1234567890123 12345678901234 "
         "1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890"
     )
     return bar.render_response()
Example #18
0
 def test_ylabels():
     chart = Bar()
     chart.x_labels = 'Red', 'Blue', 'Green'
     chart.y_labels = [
         {'value': .0001,
          'label': 'LOL'},
         {'value': .0003,
          'label': 'ROFL'},
         {'value': .0004,
          'label': 'MAO'},
         {'value': .00045,
          'label': 'LMFAO'},
         {'value': .0005,
          'label': 'GMCB'}]
     chart.add('line', [.0002, .0005, .00035])
     return chart.render_response()
Example #19
0
 def test_ylabels():
     chart = Bar()
     chart.x_labels = 'Red', 'Blue', 'Green'
     chart.y_labels = [
         {'value': .0001,
          'label': 'LOL'},
         {'value': .0003,
          'label': 'ROFL'},
         {'value': .0004,
          'label': 'MAO'},
         {'value': .00045,
          'label': 'LMFAO'},
         {'value': .0005,
          'label': 'GMCB'}]
     chart.add('line', [.0002, .0005, .00035])
     return chart.render_response()
Example #20
0
    def test_bar_links():
        bar = Bar(style=styles["neon"])
        bar.js = ("http://l:2343/svg.jquery.js", "http://l:2343/pygal-tooltips.js")
        bar.add(
            "1234",
            [
                {"value": 10, "label": "Ten", "xlink": "http://google.com?q=10"},
                {"value": 20, "tooltip": "Twenty", "xlink": "http://google.com?q=20"},
                30,
                {"value": 40, "label": "Forty", "xlink": "http://google.com?q=40"},
            ],
        )

        bar.add("4321", [40, {"value": 30, "label": "Thirty", "xlink": "http://google.com?q=30"}, 20, 10])
        bar.x_labels = map(str, range(1, 5))
        bar.logarithmic = True
        bar.zero = 1
        return bar.render_response()
Example #21
0
 def test_bar_none():
     bar = Bar()
     bar.add('Lol', [2, None, 12])
     return bar.render_response()
Example #22
0
 def test_bar():
     bar = Bar()
     bar.add('1', [1, 2, 3])
     bar.add('2', [4, 5, 6])
     bar.x_labels = ['a']
     return bar.render_response()
Example #23
0
 def test_bar_none():
     bar = Bar()
     bar.add('Lol', [2, None, 12])
     return bar.render_response()
Example #24
0
 def test_multiline_title():
     bar = Bar()
     bar.add("Looooooooooooooooooooooooooooooooooong", [2, None, 12])
     bar.title = "First line \n Second line \n Third line"
     return bar.render_response()
Example #25
0
 def test_long_title():
     bar = Bar()
     bar.add('Lol', [2, None, 12])
     bar.title = '123456789 ' * 30
     return bar.render_response()
Example #26
0
 def test_bar_none():
     bar = Bar()
     bar.add('Lol', [2, None, 12])
     bar.x_labels = range(1, 4)
     return bar.render_response()
Example #27
0
 def test_bar():
     bar = Bar()
     bar.add('1', [1, 2, 3])
     bar.add('2', [4, 5, 6])
     return bar.render_response()
Example #28
0
 def test_bar():
     bar = Bar()
     bar.add('1', [1, 2, 3])
     bar.add('2', [4, 5, 6])
     bar.x_labels = ['a']
     return bar.render_response()
Example #29
0
File: tests.py Project: Kozea/pygal
 def test_bar_none():
     bar = Bar()
     bar.add('Lol', [2, None, 12])
     bar.x_labels = range(1, 4)
     return bar.render_response()
Example #30
0
 def test_bar():
     bar = Bar()
     bar.add('1', [1, 2, 3])
     bar.add('2', [4, 5, 6])
     return bar.render_response()
Example #31
0
 def test_bar():
     bar = Bar()
     bar.add("1", [1, 2, 3])
     bar.add("2", [4, 5, 6])
     bar.x_labels = ["a"]
     return bar.render_response()