Ejemplo n.º 1
0
Archivo: tests.py Proyecto: Kozea/pygal
 def test_treemap():
     treemap = Treemap(
         style=RotateStyle(
             '#ff5995',
             opacity=.6,
             value_font_size=32,
             value_colors=['#ffffff']
         )
     )
     treemap.title = 'Binary TreeMap'
     treemap.print_values = True
     treemap.print_labels = True
     for i in range(1, 5):
         treemap.add('', [{'label': 'Area %d' % i, 'value': i}])
     treemap.add('', [2])
     # treemap.add('A', [2, 1, 12, 4, 2, 1, 1, 3, 12, 3, 4, None, 9])
     # treemap.add('B', [4, 2, 5, 10, 3, 4, 2, 7, 4, -10, None, 8, 3, 1])
     # treemap.add('C', [3, 8, 3, 3, 5, 3, 3, 5, 4, 12])
     # treemap.add('D', [23, 18])
     # treemap.add('E', [1, 2, 1, 2, 3, 3, 1, 2, 3,
     #                   4, 3, 1, 2, 1, 1, 1, 1, 1])
     # treemap.add('F', [31])
     # treemap.add('G', [5, 9.3, 8.1, 12, 4, 3, 2])
     # treemap.add('H', [12, 3, 3])
     return treemap.render_response()
Ejemplo n.º 2
0
 def test_treemap():
     treemap = Treemap(style=RotateStyle('#ff5995', opacity=.6,
                                         value_font_size=32,
                                         value_colors=['#ffffff']))
     treemap.title = 'Binary TreeMap'
     treemap.print_values = True
     treemap.print_labels = True
     for i in range(1, 5):
         treemap.add('', [{'label': 'Area %d' % i, 'value': i}])
     treemap.add('', [2])
     # treemap.add('A', [2, 1, 12, 4, 2, 1, 1, 3, 12, 3, 4, None, 9])
     # treemap.add('B', [4, 2, 5, 10, 3, 4, 2, 7, 4, -10, None, 8, 3, 1])
     # treemap.add('C', [3, 8, 3, 3, 5, 3, 3, 5, 4, 12])
     # treemap.add('D', [23, 18])
     # treemap.add('E', [1, 2, 1, 2, 3, 3, 1, 2, 3,
     #                   4, 3, 1, 2, 1, 1, 1, 1, 1])
     # treemap.add('F', [31])
     # treemap.add('G', [5, 9.3, 8.1, 12, 4, 3, 2])
     # treemap.add('H', [12, 3, 3])
     return treemap.render_response()
Ejemplo n.º 3
0
 def test_treemap():
     treemap = Treemap(style=RotateStyle("#ff5995", opacity=0.6, value_font_size=32, value_colors=["#ffffff"]))
     treemap.title = "Binary TreeMap"
     treemap.print_values = True
     treemap.print_labels = True
     for i in range(1, 5):
         treemap.add("", [{"label": "Area %d" % i, "value": i}])
     treemap.add("", [2])
     # treemap.add('A', [2, 1, 12, 4, 2, 1, 1, 3, 12, 3, 4, None, 9])
     # treemap.add('B', [4, 2, 5, 10, 3, 4, 2, 7, 4, -10, None, 8, 3, 1])
     # treemap.add('C', [3, 8, 3, 3, 5, 3, 3, 5, 4, 12])
     # treemap.add('D', [23, 18])
     # treemap.add('E', [1, 2, 1, 2, 3, 3, 1, 2, 3,
     #                   4, 3, 1, 2, 1, 1, 1, 1, 1])
     # treemap.add('F', [31])
     # treemap.add('G', [5, 9.3, 8.1, 12, 4, 3, 2])
     # treemap.add('H', [12, 3, 3])
     return treemap.render_response()
Ejemplo n.º 4
0
def plot():
    def _cmp(comp, node, field):
        comp.add(node.hostname, [d[-1] for d in node.data[field]])
        return comp

    tree_clients, pie_clients = Treemap(), Pie()
    tree_traffic_rx, pie_traffic_rx = Treemap(), Pie()
    tree_traffic_tx, pie_traffic_tx = Treemap(), Pie()

    for node in _load():
        save(node.name, node.clients(), 'clients')
        save(node.name, node.system(), 'system')
        save(node.name, node.traffic(), 'traffic')
        save(node.name, node.traffic_full(), 'traffic_full')

        save('_map', _cmp(tree_clients, node, 'clients_total'), 'clients')
        save('_pie', _cmp(pie_clients, node, 'clients_total'), 'clients')

        save('_map', _cmp(tree_traffic_rx, node, 'traffic_rx'), 'traffic_rx')
        save('_pie', _cmp(pie_traffic_rx, node, 'traffic_rx'), 'traffic_rx')

        save('_map', _cmp(tree_traffic_tx, node, 'traffic_tx'), 'traffic_tx')
        save('_pie', _cmp(pie_traffic_tx, node, 'traffic_tx'), 'traffic_tx')
Ejemplo n.º 5
0
 def test_treemap():
     treemap = Treemap(style=RotateStyle('#ff5995', opacity=.6))
     treemap.title = 'Binary TreeMap'
     treemap.add('A', [2, 1, 12, 4, 2, 1, 1, 3, 12, 3, 4, None, 9])
     treemap.add('B', [4, 2, 5, 10, 3, 4, 2, 7, 4, -10, None, 8, 3, 1])
     treemap.add('C', [3, 8, 3, 3, 5, 3, 3, 5, 4, 12])
     treemap.add('D', [23, 18])
     treemap.add('E', [1, 2, 1, 2, 3, 3, 1, 2, 3,
                       4, 3, 1, 2, 1, 1, 1, 1, 1])
     treemap.add('F', [31])
     treemap.add('G', [5, 9.3, 8.1, 12, 4, 3, 2])
     treemap.add('H', [12, 3, 3])
     return treemap.render_response()
Ejemplo n.º 6
0
 def test_treemap():
     treemap = Treemap(style=RotateStyle('#ff5995', opacity=.6))
     treemap.title = 'Binary TreeMap'
     treemap.add('A', [2, 1, 12, 4, 2, 1, 1, 3, 12, 3, 4, None, 9])
     treemap.add('B', [4, 2, 5, 10, 3, 4, 2, 7, 4, -10, None, 8, 3, 1])
     treemap.add('C', [3, 8, 3, 3, 5, 3, 3, 5, 4, 12])
     treemap.add('D', [23, 18])
     treemap.add('E',
                 [1, 2, 1, 2, 3, 3, 1, 2, 3, 4, 3, 1, 2, 1, 1, 1, 1, 1])
     treemap.add('F', [31])
     treemap.add('G', [5, 9.3, 8.1, 12, 4, 3, 2])
     treemap.add('H', [12, 3, 3])
     return treemap.render_response()