Merge branch 'ent-7963-NetFlow-Live-View-fallos-al-mostrar-datos' into 'develop'

Ent 7963 net flow live view fallos al mostrar datos

See merge request artica/pandorafms!4429
This commit is contained in:
Daniel Rodriguez 2021-09-30 12:14:43 +00:00
commit d791f050b2
4 changed files with 80 additions and 10 deletions

View File

@ -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);
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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(
"</br>" +
elements[d.source.index] +
" → " +
elements[d.target.index] +
": <b>" +
valueToBytes(d.source.value) +
"</b>" +
"<br>" +
elements[d.target.index] +
" → " +
elements[d.source.index] +
": <b>" +
valueToBytes(d.target.value) +
"</b>"
);
}
function show_tooltip(d) {
x = d3.event.pageX + 10;
y = d3.event.pageY + 10;