Merge branch '1827-Graficas-TIP-eje-x-dev' into 'develop'
1827 graficas tip eje x dev See merge request artica/pandorafms!1555
This commit is contained in:
commit
1948cdd3e4
|
@ -685,6 +685,10 @@ $options_full_escale[2] = __('On Boolean graphs');
|
||||||
$table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scale_option', $config["full_scale_option"], '', '', 0, true, false, false);
|
$table_chars->data[$row][1] = html_print_select($options_full_escale, 'full_scale_option', $config["full_scale_option"], '', '', 0, true, false, false);
|
||||||
$row++;
|
$row++;
|
||||||
|
|
||||||
|
$table_chars->data[$row][0] = __('Graph image height');
|
||||||
|
$table_chars->data[$row][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
|
||||||
|
$row++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$table_font->data[$row][0] = __('Font path');
|
$table_font->data[$row][0] = __('Font path');
|
||||||
$fonts = load_fonts();
|
$fonts = load_fonts();
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
// Global & session manageme
|
// Global & session manageme
|
||||||
session_id($_GET["session_id"]);
|
session_id($_REQUEST["session_id"]);
|
||||||
if (file_exists(session_save_path() . "/pansess_" . session_id())) {
|
if (file_exists(session_save_path() . "/pansess_" . session_id()) ) {
|
||||||
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
|
$user = file_get_contents(session_save_path() . "/pansess_" . session_id());
|
||||||
}
|
}
|
||||||
session_start();
|
session_start();
|
||||||
|
@ -24,6 +24,7 @@ if (isset($user)) {
|
||||||
session_write_close();
|
session_write_close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once ('config.php');
|
require_once ('config.php');
|
||||||
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
require_once ($config['homedir'] . '/include/auth/mysql.php');
|
||||||
require_once ($config['homedir'] . '/include/functions.php');
|
require_once ($config['homedir'] . '/include/functions.php');
|
||||||
|
@ -38,8 +39,10 @@ require_once ($config['homedir'] . '/include/functions_tags.php');
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
//get_parameter(array)('data', '');
|
||||||
|
|
||||||
|
$params = json_decode($_REQUEST['data'], true);
|
||||||
|
|
||||||
$params = json_decode($_GET['data'], true);
|
|
||||||
// Metaconsole connection to the node
|
// Metaconsole connection to the node
|
||||||
$server_id = $params['server_id'];
|
$server_id = $params['server_id'];
|
||||||
|
|
||||||
|
@ -94,14 +97,20 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$params['only_image'] = false;
|
||||||
$params['only_image'] = false;
|
$params['width'] = (int) $_REQUEST['viewport_width'];
|
||||||
$params['width'] = '1048';
|
|
||||||
$params['menu'] = false;
|
$params['menu'] = false;
|
||||||
|
|
||||||
$params_combined = json_decode($_GET['data_combined'], true);
|
if((!isset($params['width']) || ($params['width'] <= 0))) {
|
||||||
$module_list = json_decode($_GET['data_module_list'], true);
|
$params['width'] = 1048;
|
||||||
$type_graph_pdf = $_GET['type_graph_pdf'];
|
}
|
||||||
|
|
||||||
|
$params_combined = json_decode($_REQUEST['data_combined'], true);
|
||||||
|
$module_list = json_decode($_REQUEST['data_module_list'], true);
|
||||||
|
$type_graph_pdf = $_REQUEST['type_graph_pdf'];
|
||||||
|
|
||||||
|
$aux_font_size = $config['font_size'];
|
||||||
|
$config['font_size'] = $config['font_size'] + 3;
|
||||||
|
|
||||||
if($type_graph_pdf == 'combined'){
|
if($type_graph_pdf == 'combined'){
|
||||||
echo '<div>';
|
echo '<div>';
|
||||||
|
@ -117,6 +126,8 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||||
echo grafico_modulo_sparse($params);
|
echo grafico_modulo_sparse($params);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$config['font_size'] = $aux_font_size;
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -3217,13 +3217,15 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$file_js = $config["homedir"] . "/include/web2image.js";
|
$file_js = $config["homedir"] . "/include/web2image.js";
|
||||||
$url = $config["homeurl"] . "/include/chart_generator.php";
|
$url = $config["homeurl"] . "include/chart_generator.php";
|
||||||
$img_file = "img_". uniqid() .".png";
|
$img_file = "img_". uniqid() .".png";
|
||||||
$img_path = $config["homedir"] . "/attachment/" . $img_file;
|
$img_path = $config["homedir"] . "/attachment/" . $img_file;
|
||||||
$img_url = $config["homeurl"] . "attachment/" . $img_file;
|
$img_url = $config["homeurl"] . "attachment/" . $img_file;
|
||||||
|
|
||||||
$width_img = 500;
|
$width_img = 500;
|
||||||
$height_img = 450;
|
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 350;
|
||||||
|
|
||||||
|
$params['height'] = $height_img;
|
||||||
|
|
||||||
$params_encode_json = urlencode(json_encode($params));
|
$params_encode_json = urlencode(json_encode($params));
|
||||||
|
|
||||||
|
@ -3252,9 +3254,12 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
||||||
$result = exec($cmd);
|
$result = exec($cmd);
|
||||||
|
|
||||||
if($params['return_img_base_64']){
|
if($params['return_img_base_64']){
|
||||||
|
// To be used in alerts
|
||||||
|
$width_img = 500;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
// to be used in PDF files
|
||||||
$config["temp_images"][] = $img_path;
|
$config["temp_images"][] = $img_path;
|
||||||
return '<img src="' . $img_url . '" />';
|
return '<img src="' . $img_url . '" />';
|
||||||
}
|
}
|
||||||
|
|
|
@ -627,6 +627,9 @@ function config_update_config () {
|
||||||
|
|
||||||
if (!config_update_value ('full_scale_option', (int) get_parameter('full_scale_option', 0)))
|
if (!config_update_value ('full_scale_option', (int) get_parameter('full_scale_option', 0)))
|
||||||
$error_update[] = __('Default full scale (TIP)');
|
$error_update[] = __('Default full scale (TIP)');
|
||||||
|
|
||||||
|
if (!config_update_value ('graph_image_height', (int) get_parameter('graph_image_height', 0)))
|
||||||
|
$error_update[] = __('Default height of the chart image');
|
||||||
|
|
||||||
if (!config_update_value ('classic_menu', (bool) get_parameter('classic_menu', false)))
|
if (!config_update_value ('classic_menu', (bool) get_parameter('classic_menu', false)))
|
||||||
$error_update[] = __('Classic menu mode');
|
$error_update[] = __('Classic menu mode');
|
||||||
|
@ -1851,6 +1854,10 @@ function config_process_config () {
|
||||||
config_update_value ('render_proc', 0);
|
config_update_value ('render_proc', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($config['graph_image_height'])) {
|
||||||
|
config_update_value ('graph_image_height', 350);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($config["render_proc_ok"])) {
|
if (!isset($config["render_proc_ok"])) {
|
||||||
config_update_value ('render_proc_ok', __('Ok') );
|
config_update_value ('render_proc_ok', __('Ok') );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1638,7 +1638,8 @@ function pandoraFlotArea( graph_id, values, legend,
|
||||||
font: {
|
font: {
|
||||||
size: font_size + 2,
|
size: font_size + 2,
|
||||||
color: legend_color,
|
color: legend_color,
|
||||||
family: font+'Font'
|
family: font+'Font',
|
||||||
|
variant: "small-caps"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
yaxes: [{
|
yaxes: [{
|
||||||
|
@ -1933,9 +1934,8 @@ function pandoraFlotArea( graph_id, values, legend,
|
||||||
$('#legend_' + graph_id).height());
|
$('#legend_' + graph_id).height());
|
||||||
|
|
||||||
$('#timestamp_'+graph_id).css('color', legend_color);
|
$('#timestamp_'+graph_id).css('color', legend_color);
|
||||||
$('#timestamp_'+graph_id).css('font-size', font_size + 2);
|
$('#timestamp_'+graph_id).css('font-size', font_size + 2+'px');
|
||||||
$('#timestamp_'+graph_id).css('font-family', font + 'Font');
|
$('#timestamp_'+graph_id).css('font-family', font + 'Font');
|
||||||
$('#timestamp_'+graph_id).css('color', legend_color);
|
|
||||||
|
|
||||||
if (timesize+timenewpos > canvaslimit) {
|
if (timesize+timenewpos > canvaslimit) {
|
||||||
$('#timestamp_'+graph_id).css('left', timenewpos - timesize);
|
$('#timestamp_'+graph_id).css('left', timenewpos - timesize);
|
||||||
|
@ -1998,6 +1998,8 @@ function pandoraFlotArea( graph_id, values, legend,
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('color', legend_color);
|
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('color', legend_color);
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('font-size', font_size + 2 +'px');
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').eq(i).css('font-family', font + 'Font');
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -2164,6 +2166,9 @@ function pandoraFlotArea( graph_id, values, legend,
|
||||||
.eq(i).html(label_aux);
|
.eq(i).html(label_aux);
|
||||||
}
|
}
|
||||||
$('#legend_' + graph_id + ' .legendLabel').css('color', legend_color);
|
$('#legend_' + graph_id + ' .legendLabel').css('color', legend_color);
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').css('font-size', font_size + 2 +'px');
|
||||||
|
$('#legend_' + graph_id + ' .legendLabel').css('font-family', font + 'Font');
|
||||||
|
|
||||||
plot.clearCrosshair();
|
plot.clearCrosshair();
|
||||||
if(!vconsole){
|
if(!vconsole){
|
||||||
overview.clearCrosshair();
|
overview.clearCrosshair();
|
||||||
|
|
|
@ -137,7 +137,7 @@ function flot_area_graph (
|
||||||
$return = "<div class='parent_graph' style='width: " . ($params['width']) . ";" . $background_style . "'>";
|
$return = "<div class='parent_graph' style='width: " . ($params['width']) . ";" . $background_style . "'>";
|
||||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||||
if($params['show_legend']){
|
if($params['show_legend']){
|
||||||
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $params['font_size'] ."pt !important; color:" . $params['legend_color'] . " !important;'></p>";
|
$return .= "<p id='legend_$graph_id'></p>";
|
||||||
}
|
}
|
||||||
if(isset($params['graph_combined']) && $params['graph_combined'] &&
|
if(isset($params['graph_combined']) && $params['graph_combined'] &&
|
||||||
(!isset($params['from_interface']) || !$params['from_interface']) ){
|
(!isset($params['from_interface']) || !$params['from_interface']) ){
|
||||||
|
|
|
@ -4,7 +4,7 @@ if (system.args.length < 3 || system.args.length > 11) {
|
||||||
phantom.exit(1);
|
phantom.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var webPage = require('webpage');
|
var webPage = require('webpage');
|
||||||
var page = webPage.create();
|
var page = webPage.create();
|
||||||
var url = system.args[1];
|
var url = system.args[1];
|
||||||
var type_graph_pdf = system.args[2];
|
var type_graph_pdf = system.args[2];
|
||||||
|
@ -12,37 +12,40 @@ var url_params = system.args[3];
|
||||||
var url_params_comb = system.args[4];
|
var url_params_comb = system.args[4];
|
||||||
var url_module_list = system.args[5];
|
var url_module_list = system.args[5];
|
||||||
var output_filename = system.args[6];
|
var output_filename = system.args[6];
|
||||||
var _width = system.args[7];
|
var viewport_width = system.args[7];
|
||||||
var _height = system.args[8];
|
var viewport_height = system.args[8];
|
||||||
var session_id = system.args[9];
|
var session_id = system.args[9];
|
||||||
var base_64 = system.args[10];
|
var base_64 = system.args[10];
|
||||||
|
|
||||||
|
|
||||||
if (!_width) {
|
if (!viewport_width) {
|
||||||
_width = 750;
|
viewport_width = 750;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_height) {
|
if (!viewport_height) {
|
||||||
_height = 350;
|
viewport_height = 350;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type_graph_pdf == 'combined'){
|
if(type_graph_pdf == 'combined'){
|
||||||
finish_url = url + "?" + "data=" + url_params +
|
post_data = "data=" + url_params +
|
||||||
"&data_combined=" + url_params_comb +
|
"&data_combined=" + url_params_comb +
|
||||||
"&data_module_list=" + url_module_list +
|
"&data_module_list=" + url_module_list +
|
||||||
"&type_graph_pdf=" + type_graph_pdf +
|
"&type_graph_pdf=" + type_graph_pdf +
|
||||||
"&session_id=" + session_id;
|
"&session_id=" + session_id;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
finish_url = url + "?" + "data=" + url_params +
|
post_data = "data=" + url_params +
|
||||||
"&type_graph_pdf=" + type_graph_pdf +
|
"&type_graph_pdf=" + type_graph_pdf +
|
||||||
"&session_id=" + session_id;
|
"&session_id=" + session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
page.viewportSize = { width: _width, height: _height };
|
page.viewportSize = {
|
||||||
//page.zoomFactor = 1.75;
|
width: viewport_width,
|
||||||
|
height: viewport_height
|
||||||
|
};
|
||||||
|
page.zoomFactor = 1;
|
||||||
|
|
||||||
page.open(finish_url, function start(status) {
|
page.open(url, 'POST', post_data, function start(status) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,6 +55,7 @@ page.onLoadFinished = function (status) {
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var base64 = page.renderBase64('png');
|
var base64 = page.renderBase64('png');
|
||||||
|
//XXXX
|
||||||
console.log(base64);
|
console.log(base64);
|
||||||
}
|
}
|
||||||
phantom.exit();
|
phantom.exit();
|
||||||
|
|
Loading…
Reference in New Issue