Merge branch 'ent-5672-Graficas-gauge-no-se-muestran-bien-en-PDF' into 'develop'

Fixed error in gauges

See merge request artica/pandorafms!3261
This commit is contained in:
Daniel Rodriguez 2020-07-14 11:01:21 +02:00
commit 52dc38fcb2
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>'; echo '<div>';
switch ($type_graph_pdf) { switch ($type_graph_pdf) {
case 'combined': case 'combined':
$params['pdf'] = true;
echo graphic_combined_module( echo graphic_combined_module(
$module_list, $module_list,
$params, $params,

View File

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

View File

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

View File

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

View File

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