Merge branch '2666-Graficas_en_informes' into 'develop'

fixed heigth charts for reports

See merge request artica/pandorafms!1745
This commit is contained in:
vgilc 2018-09-11 09:38:35 +02:00
commit 995bd42d70
5 changed files with 48 additions and 43 deletions

View File

@ -709,6 +709,10 @@ $table_chars->data[$row][1] = html_print_select($options_zoom_graphs, 'zoom_grap
$row++;
$table_chars->data[$row][0] = __('Graph image height');
$table_chars->data[$row][0] .= ui_print_help_tip(
__('This is the height in pixels of the module graph or custom graph in the reports (both: HTML and PDF)'),
true
);
$table_chars->data[$row][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
$row++;

View File

@ -3274,7 +3274,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
$img_url = $config["homeurl"] . "attachment/" . $img_file;
$width_img = 500;
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 350;
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 280;
$params['height'] = $height_img;

View File

@ -631,10 +631,10 @@ function config_update_config () {
if (!config_update_value ('type_mode_graph', (int) get_parameter('type_mode_graph', 0)))
$error_update[] = __('Default soft graphs');
if (!config_update_value ('zoom_graph', (int) get_parameter('zoom_graph', 0)))
if (!config_update_value ('zoom_graph', (int) get_parameter('zoom_graph', 1)))
$error_update[] = __('Default zoom graphs');
if (!config_update_value ('graph_image_height', (int) get_parameter('graph_image_height', 0)))
if (!config_update_value ('graph_image_height', (int) get_parameter('graph_image_height', 280)))
$error_update[] = __('Default height of the chart image');
if (!config_update_value ('classic_menu', (bool) get_parameter('classic_menu', false)))
@ -667,10 +667,7 @@ function config_update_config () {
}
}
//--------------------------------------------------
//--------------------------------------------------
// CUSTOM INTERVAL VALUES
//--------------------------------------------------
@ -1859,11 +1856,15 @@ function config_process_config () {
if (!isset($config['render_proc'])) {
config_update_value ('render_proc', 0);
}
if (!isset($config['graph_image_height'])) {
config_update_value ('graph_image_height', 320);
config_update_value ('graph_image_height', 280);
}
if (!isset($config['zoom_graph'])) {
config_update_value ('zoom_graph', 1);
}
if (!isset($config["render_proc_ok"])) {
config_update_value ('render_proc_ok', __('Ok') );
}

View File

@ -892,7 +892,9 @@ function grafico_modulo_sparse ($params) {
}
if(!isset($params['zoom'])){
$params['zoom'] = $config['zoom_graph'];
$params['zoom'] = $config['zoom_graph']
? $config['zoom_graph']
: 1;
}
if(!isset($params['type_mode_graph'])){

View File

@ -628,7 +628,6 @@ function reporting_make_reporting_data($report = null, $id_report,
}
$index_content++;
}
return reporting_check_structure_report($report);
}
@ -2807,18 +2806,17 @@ function agents_get_network_interfaces_array(
$row_interface['chart'] = null;
$width = null;
$height = null;
$params =array(
'period' => $content['period'],
'width' => $width,
'height' => $height,
'unit_name' => array_fill(0, count($interface['traffic']), __("bytes/s")),
'date' => $report["datetime"],
'only_image'=> $pdf,
'homeurl' => $config['homeurl'],
'fullscale' => $fullscale,
'server_id' => $id_meta
'server_id' => $id_meta,
'height' => $config['graph_image_height']
);
$params_combined = array(
@ -3540,7 +3538,8 @@ function reporting_simple_baseline_graph($report, $content,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => $ttl,
'array_data_create' => $baseline_data,
'server_id' => $id_meta
'server_id' => $id_meta,
'height' => $config['graph_image_height']
);
$return['chart'] = grafico_modulo_sparse ($params);
@ -3645,13 +3644,13 @@ function reporting_projection_graph($report, $content,
$params =array(
'period' => $content['period'],
'width' => $width,
'height' => $height,
'date' => $report["datetime"],
'unit' => '',
'only_image' => $pdf,
'homeurl' => ui_get_full_url(false, false, false, false) . '/',
'ttl' => $ttl,
'server_id' => $id_meta
'server_id' => $id_meta,
'height' => $config['graph_image_height']
);
$params_combined = array(
@ -3884,27 +3883,27 @@ function reporting_value($report, $content, $type,$pdf) {
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
if($pdf){
$only_image = 1;
}
$params =array(
'agent_module_id' => $content['id_agent_module'],
'period' => $content['period'],
'width' => '600px',
'pure' => false,///true
'date' => $report["datetime"],
'only_image' => $only_image,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => 1,///2
'type_graph' => $config['type_module_charts'],
'time_interval' => $content['lapse'],
'server_id' => $id_meta
'agent_module_id' => $content['id_agent_module'],
'period' => $content['period'],
'width' => '600px',
'pure' => false,///true
'date' => $report["datetime"],
'only_image' => $only_image,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => 1,///2
'type_graph' => $config['type_module_charts'],
'time_interval' => $content['lapse'],
'server_id' => $id_meta,
'height' => $config['graph_image_height']
);
switch ($type) {
switch ($type) {
case 'max':
if($content['lapse_calc'] == 0){
$value = reporting_get_agentmodule_data_max(
@ -6344,24 +6343,23 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$return['chart'] = '';
$width =null;
$height =null;
switch ($type) {
case 'dinamic':
case 'static':
$params =array(
'period' => $content['period'],
'width' => $width,
'height' => $height,
'date' => $report["datetime"],
'only_image' => $pdf,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => $ttl,
'percentil' => $graphs[0]["percentil"],
'fullscale' => $graphs[0]["fullscale"],
'server_id' => $id_meta
'server_id' => $id_meta,
'height' => $config['graph_image_height']
);
$params_combined = array(
'stacked' => $graphs[0]["stacked"],
'summatory' => $graphs[0]["summatory_series"],
@ -6464,7 +6462,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
'show_unknown' => true,
'percentil' => ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
'fullscale' => $fullscale,
'server_id' => $id_meta
'server_id' => $id_meta,
'height' => $config['graph_image_height']
);
$return['chart'] = grafico_modulo_sparse($params);
@ -6491,15 +6490,14 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
function reporting_get_date_text($report = null, $content = null) {
global $config;
$return = array();
$return['date'] = null;
$return['period'] = null;
$return['from'] = null;
$return['to'] = null;
if (!empty($report) && !empty($content)) {
if ($content['period'] == 0) {
$es = json_decode($content['external_source'], true);
if ($es['date'] == 0) {
@ -6515,7 +6513,7 @@ function reporting_get_date_text($report = null, $content = null) {
$return['to'] = $report["datetime"];
}
}
return $return;
}
@ -6531,7 +6529,7 @@ function reporting_check_structure_report($return) {
$return['datetime'] = "";
if (!isset($return['period']))
$return['period'] = "";
return $return;
}
@ -6551,7 +6549,7 @@ function reporting_check_structure_content($report) {
$report["date"]['from'] = "";
$report["date"]['to'] = "";
}
return $report;
}