Fixed error in gauges

This commit is contained in:
Daniel Barbero Martin 2020-06-01 14:48:53 +02:00
parent 467bcf615f
commit 8eb3a982e1
5 changed files with 34 additions and 19 deletions

View File

@ -189,6 +189,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
echo '<div>';
switch ($type_graph_pdf) {
case 'combined':
$params['pdf'] = true;
echo graphic_combined_module(
$module_list,
$params,

View File

@ -2003,6 +2003,12 @@ function graphic_combined_module(
}
}
if (isset($params['pdf']) === true && $params['pdf'] === true) {
$transitionDuration = 0;
} else {
$transitionDuration = 500;
}
$output = stacked_gauge(
$graph_values,
$new_width,
@ -2018,7 +2024,8 @@ function graphic_combined_module(
$config['fontpath'],
$fixed_font_size,
'',
$homeurl
$homeurl,
$transitionDuration
);
break;

View File

@ -638,7 +638,8 @@ function stacked_gauge(
$font='',
$font_size='',
$unit='',
$homeurl=''
$homeurl='',
$transitionDuration=500
) {
include_once 'functions_d3.php';
@ -656,7 +657,8 @@ function stacked_gauge(
$unit,
$font,
($font_size + 2),
$no_data_image
$no_data_image,
$transitionDuration
);
}

View File

@ -294,7 +294,8 @@ function d3_gauges(
$unit,
$font,
$font_size,
$no_data_image
$no_data_image,
$transitionDuration
) {
global $config;
@ -310,7 +311,7 @@ function d3_gauges(
$output .= "<script language=\"javascript\" type=\"text/javascript\">
var data = $data;
createGauges(data, '$width', '$height','$font_size','$no_data_image','$font');
createGauges(data, '$width', '$height','$font_size','$no_data_image','$font', '$transitionDuration');
</script>";
return $output;

View File

@ -1005,7 +1005,8 @@ function createGauge(
critical_inverse,
font_size,
height,
font
font,
transitionDuration
) {
var gauges;
@ -1014,7 +1015,8 @@ function createGauge(
label: etiqueta,
min: undefined != min ? min : 0,
max: undefined != max ? max : 100,
font_size: font_size
font_size: font_size,
transitionDuration: transitionDuration
};
if (value == null) {
@ -1128,7 +1130,7 @@ function createGauge(
gauges = new Gauge(name, config, font);
gauges.render();
gauges.redraw(value);
gauges.redraw(value, config.transitionDuration);
$(".gauge>text").each(function() {
label = $(this).text();
@ -1155,12 +1157,17 @@ function createGauge(
$(this).text(text);
}
});
config = false;
max_warning2 = false;
min_warning2 = false;
}
function createGauges(data, width, height, font_size, no_data_image, font) {
function createGauges(
data,
width,
height,
font_size,
no_data_image,
font,
transitionDuration
) {
var nombre,
label,
minimun_warning,
@ -1211,7 +1218,8 @@ function createGauges(data, width, height, font_size, no_data_image, font) {
critical_inverse,
font_size,
height,
font
font,
transitionDuration
);
}
}
@ -1247,7 +1255,7 @@ function Gauge(placeholderName, configuration, font) {
this.config.yellowColor = configuration.yellowColor || "#FF9900";
this.config.redColor = configuration.redColor || "#DC3912";
this.config.transitionDuration = configuration.transitionDuration || 500;
this.config.transitionDuration = configuration.transitionDuration;
};
this.render = function() {
@ -1481,11 +1489,7 @@ function Gauge(placeholderName, configuration, font) {
var pointer = pointerContainer.selectAll("path");
pointer
.transition()
.duration(
undefined != transitionDuration
? transitionDuration
: this.config.transitionDuration
)
.duration(undefined != transitionDuration ? transitionDuration : 0)
//.delay(0)
//.ease("linear")
//.attr("transform", function(d)