Added chart to network report

Former-commit-id: 3dab00002afd311e787f1f4fc062958e189948d7
This commit is contained in:
Fermin 2019-03-05 12:33:01 +01:00
parent a01319464e
commit 233ede643b

View File

@ -164,8 +164,9 @@ $hidden_main_link = [
'top' => $top, 'top' => $top,
]; ];
// Print the data. // Print the data and build the chart.
$table->data = []; $table->data = [];
$chart_data = [];
foreach ($data as $item) { foreach ($data as $item) {
$row = []; $row = [];
$row['main'] = html_print_link_with_params( $row['main'] = html_print_link_with_params(
@ -181,12 +182,24 @@ foreach ($data as $item) {
1024, 1024,
'B' 'B'
); );
$table->data[] = $row; $table->data[] = $row;
// Build the pie graph data structure.
$chart_data[$item['host']] = $item['sum_bytes'];
} }
html_print_table($table); html_print_table($table);
// Print the graph.
echo '<div>';
echo pie_graph(
$chart_data,
320,
200,
__('Others')
);
echo '<div>';
?> ?>
<script> <script>
// Configure jQuery timepickers. // Configure jQuery timepickers.