Added modifications to value option

This commit is contained in:
Arturo Gonzalez 2017-10-05 17:33:37 +02:00
parent 7d455d3ac2
commit 3b03bfe6b5
4 changed files with 45 additions and 41 deletions

View File

@ -388,7 +388,6 @@ function update_button_palette_callback() {
else { else {
setPercentileBar(idItem, values); setPercentileBar(idItem, values);
} }
break; break;
case 'module_graph': case 'module_graph':
if($('#dir_items').html() == 'horizontal'){ if($('#dir_items').html() == 'horizontal'){
@ -634,7 +633,8 @@ function readFields() {
values['event_max_time_row'] = $("select[name=event_max_time_row]").val(); values['event_max_time_row'] = $("select[name=event_max_time_row]").val();
values['type_percentile'] = $("select[name=type_percentile]").val(); values['type_percentile'] = $("select[name=type_percentile]").val();
values['percentile_color'] = $("input[name='percentile_color']").val(); values['percentile_color'] = $("input[name='percentile_color']").val();
values['value_show'] = $("input[name=value_show]:checked").val(); values['value_show'] = $("select[name=value_show]").val();
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0; values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
values['id_group'] = $("select[name=group]").val(); values['id_group'] = $("select[name=group]").val();
values['id_custom_graph'] = parseInt( values['id_custom_graph'] = parseInt(
@ -1291,14 +1291,7 @@ function loadFieldsFromDB(item) {
} }
if (key == 'value_show') { if (key == 'value_show') {
if (val == 'percent') { $("select[name=value_show]").val(val);
$("input[name=value_show][value=percent]")
.attr("checked", "checked");
}
else {
$("input[name=value_show][value=value]")
.attr("checked", "checked");
}
} }
if (key == 'id_group') { if (key == 'id_group') {
@ -3114,9 +3107,6 @@ function updateDB(type, idElement , values, event) {
} }
function copyDB(idItem) { function copyDB(idItem) {
console.log(idItem);
metaconsole = $("input[name='metaconsole']").val(); metaconsole = $("input[name='metaconsole']").val();
parameter = Array(); parameter = Array();
@ -3572,8 +3562,6 @@ function eventsItems(drag) {
} }
} }
else{ else{
console.log('Dragstart');
multiDragStart(event); multiDragStart(event);
} }
@ -3590,8 +3578,6 @@ function eventsItems(drag) {
updateDB(selectedItem, idItem, values, 'dragstop'); updateDB(selectedItem, idItem, values, 'dragstop');
} }
else{ else{
console.log('Dragstop');
multidragStop(event); multidragStop(event);
} }
}); });
@ -3679,10 +3665,6 @@ function eventsItems(drag) {
break; break;
} }
} }
else{
console.log('Drag');
}
}); });
} }

View File

@ -1590,11 +1590,23 @@ function visual_map_print_item($mode = "read", $layoutData,
} }
} }
else { else {
if($width == 0){ if (($layoutData['image'] == 'value') && ($value_text !== false)) {
$img = progress_circular_bar($id, $percentile, 100,100, $border_color); $unit_text = db_get_sql ('SELECT unit
FROM tagente_modulo
WHERE id_agente_modulo = ' . $id_module);
$unit_text = trim(io_safe_output($unit_text));
$percentile = $value_text;
}
else {
$unit_text = "%";
}
if($width < 200){
$img = progress_circular_bar($id, $percentile, 200,200, $border_color, $unit_text);
} }
else{ else{
$img = progress_circular_bar($id, $percentile, $width, $width, $border_color); $img = progress_circular_bar($id, $percentile, $width, $width, $border_color, $unit_text);
} }
} }
@ -1648,15 +1660,25 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = '<img src="images/console/signes/circular-progress-bar-interior.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">'; $img = '<img src="images/console/signes/circular-progress-bar-interior.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
} }
} }
else{ else {
if ($type == CIRCULAR_INTERIOR_PROGRESS_BAR) { if (($layoutData['image'] == 'value') && ($value_text !== false)) {
if($width == 0){ $unit_text = db_get_sql ('SELECT unit
$img = progress_circular_bar_interior($id, $percentile, 100,100, $border_color); FROM tagente_modulo
WHERE id_agente_modulo = ' . $id_module);
} $unit_text = trim(io_safe_output($unit_text));
else{
$img = progress_circular_bar_interior($id, $percentile, $width, $width, $border_color); $percentile = $value_text;
} }
else {
$unit_text = "%";
}
if($width < 200){
$img = progress_circular_bar_interior($id, $percentile, 200,200, $border_color);
}
else{
$img = progress_circular_bar_interior($id, $percentile, $width, $width, $border_color);
} }
} }

View File

@ -310,7 +310,7 @@ function ux_console_phases_donut ($phases, $id, $return = false) {
return $output; return $output;
} }
function progress_circular_bar ($id, $percentile, $width, $height, $color) { function progress_circular_bar ($id, $percentile, $width, $height, $color, $unit = "%") {
global $config; global $config;
$recipient_name = "circular_progress_bar_" . $id; $recipient_name = "circular_progress_bar_" . $id;
@ -321,13 +321,13 @@ function progress_circular_bar ($id, $percentile, $width, $height, $color) {
$output .= "<div id=" . $recipient_name . " style='overflow: hidden;'></div>"; $output .= "<div id=" . $recipient_name . " style='overflow: hidden;'></div>";
$output .= include_javascript_d3(true); $output .= include_javascript_d3(true);
$output .= "<script language=\"javascript\" type=\"text/javascript\"> $output .= "<script language=\"javascript\" type=\"text/javascript\">
print_circular_progress_bar('" . $recipient_name_to_js . "', " . (int)$percentile . ", " . (int)$width . ", " . (int)$height . ", '" . $color . "'); print_circular_progress_bar('" . $recipient_name_to_js . "', " . (int)$percentile . ", " . (int)$width . ", " . (int)$height . ", '" . $color . "', '" . $unit . "');
</script>"; </script>";
return $output; return $output;
} }
function progress_circular_bar_interior ($id, $percentile, $width, $height, $color) { function progress_circular_bar_interior ($id, $percentile, $width, $height, $color, $unit = "%") {
global $config; global $config;
$recipient_name = "circular_progress_bar_interior_" . $id; $recipient_name = "circular_progress_bar_interior_" . $id;
@ -338,7 +338,7 @@ function progress_circular_bar_interior ($id, $percentile, $width, $height, $col
$output .= "<div id=" . $recipient_name . " style='overflow: hidden;'></div>"; $output .= "<div id=" . $recipient_name . " style='overflow: hidden;'></div>";
$output .= include_javascript_d3(true); $output .= include_javascript_d3(true);
$output .= "<script language=\"javascript\" type=\"text/javascript\"> $output .= "<script language=\"javascript\" type=\"text/javascript\">
print_interior_circular_progress_bar('" . $recipient_name_to_js . "', " . (int)$percentile . ", " . (int)$width . ", " . (int)$height . ", '" . $color . "'); print_interior_circular_progress_bar('" . $recipient_name_to_js . "', " . (int)$percentile . ", " . (int)$width . ", " . (int)$height . ", '" . $color . "', '" . $unit . "');
</script>"; </script>";
return $output; return $output;

View File

@ -1494,7 +1494,7 @@ function print_phases_donut (recipient, phases) {
} }
} }
function print_circular_progress_bar (recipient, percentile, width, height, color) { function print_circular_progress_bar (recipient, percentile, width, height, color, unit) {
var twoPi = Math.PI * 2; var twoPi = Math.PI * 2;
var radius = (width / 2) - 10; var radius = (width / 2) - 10;
var border = 20; var border = 20;
@ -1556,7 +1556,7 @@ function print_circular_progress_bar (recipient, percentile, width, height, colo
.style("font-family", "arial") .style("font-family", "arial")
.style("font-weight", "bold") .style("font-weight", "bold")
.style("font-size", 16) .style("font-size", 16)
.text("%") .text(unit)
.attr('text-anchor', 'middle') .attr('text-anchor', 'middle')
.attr('dy', '40'); .attr('dy', '40');
@ -1579,7 +1579,7 @@ function print_circular_progress_bar (recipient, percentile, width, height, colo
})(); })();
} }
function print_interior_circular_progress_bar (recipient, percentile, width, height, color) { function print_interior_circular_progress_bar (recipient, percentile, width, height, color, unit) {
var twoPi = Math.PI * 2; var twoPi = Math.PI * 2;
var radius = (width / 2) - 30; var radius = (width / 2) - 30;
var radius2 = (width / 2) - 10; var radius2 = (width / 2) - 10;
@ -1655,7 +1655,7 @@ function print_interior_circular_progress_bar (recipient, percentile, width, hei
.style("font-family", "arial") .style("font-family", "arial")
.style("font-weight", "bold") .style("font-weight", "bold")
.style("font-size", 16) .style("font-size", 16)
.text("%") .text(unit)
.attr('text-anchor', 'middle') .attr('text-anchor', 'middle')
.attr('dy', '40'); .attr('dy', '40');