diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 27c4ac083a..d8760caa1a 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -4808,7 +4808,11 @@ function graph_netflow_aggregate_pie($data, $aggregate, $ttl=1, $only_image=fals $water_mark, $config['fontpath'], $config['font_size'], - $ttl + $ttl, + false, + '', + false, + 6 ); } @@ -4833,7 +4837,7 @@ function graph_netflow_circular_mesh($data) include_once $config['homedir'].'/include/graphs/functions_d3.php'; - return d3_relationship_graph($data['elements'], $data['matrix'], 700, true); + return d3_relationship_graph($data['elements'], $data['matrix'], 900, true); } diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index 8007c19077..5c05c19a7c 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -420,7 +420,8 @@ function netflow_get_data( $max, $absolute, $connection_name='', - $address_resolution=false + $address_resolution=false, + $network_format_bytes=false ) { global $nfdump_date_format; global $config; @@ -560,7 +561,25 @@ function netflow_get_data( continue; } - $values['data'][$interval_end][$line['agg']] = $line['data']; + if ($network_format_bytes == true) { + $pos = 0; + $number = $line['data']; + while ($number >= 1024) { + // As long as the number can be divided by divider. + $pos++; + // Position in array starting with 0. + $number = ($number / 1024); + } + + while ($pos > 0) { + $number = ($number * 1000); + $pos --; + } + + $values['data'][$interval_end][$line['agg']] = $number; + } else { + $values['data'][$interval_end][$line['agg']] = $line['data']; + } } } @@ -1080,9 +1099,10 @@ function netflow_draw_item( $filter, $aggregate, $max_aggregates, - false, + true, $connection_name, - $address_resolution + $address_resolution, + true ); if (empty($data) === true) { diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 00004e6d71..ec83514c46 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -782,7 +782,8 @@ function pie_graph( $ttl=1, $legend_position=false, $colors='', - $hide_labels=false + $hide_labels=false, + $max_values=9 ) { if (empty($chart_data) === true) { return graph_nodata_image($width, $height, 'pie'); @@ -793,8 +794,7 @@ function pie_graph( } // This library allows only 8 colors. - $max_values = 9; - + // $max_values = 9; // Remove the html_entities. $temp = []; foreach ($chart_data as $key => $value) { diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 8912ae673b..8495a8728b 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -98,6 +98,32 @@ function chordDiagram(recipient, elements, matrix, width) { }) .transition() .style("opacity", opacity); + + if (event.type == "mouseover") { + const chords = chord.chords(); + let aux = 0; + $.each(chords, function(key, value) { + console.log(aux); + if (aux < 5) { + if ( + (value.source.index == i && value.target.subindex == i) || + (value.source.subindex == i && value.target.index == i) + ) { + if ( + $("#tooltip").is(":hidden") || + $("#tooltip").length == 0 + ) { + show_tooltip(value); + } else { + add_tooltip(value); + aux++; + } + } + } + }); + } else { + hide_tooltip(); + } }; }; @@ -122,7 +148,8 @@ function chordDiagram(recipient, elements, matrix, width) { .style("stroke", fill) .attr("d", arc) .on("mouseover", fade(0.1)) - .on("mouseout", fade(1)); + .on("mouseout", fade(1)) + .on("mousemove", move_tooltip); g.append("svg:text") .each(function(d) { @@ -259,6 +286,25 @@ function chordDiagram(recipient, elements, matrix, width) { ); } + function add_tooltip(d) { + $("#tooltip").append( + "
" + + elements[d.source.index] + + " → " + + elements[d.target.index] + + ": " + + valueToBytes(d.source.value) + + "" + + "
" + + elements[d.target.index] + + " → " + + elements[d.source.index] + + ": " + + valueToBytes(d.target.value) + + "" + ); + } + function show_tooltip(d) { x = d3.event.pageX + 10; y = d3.event.pageY + 10;