custom graph

This commit is contained in:
daniel 2018-04-27 10:03:05 +02:00
parent 2a81703a68
commit 30dc841bae
4 changed files with 477 additions and 1041 deletions

View File

@ -2818,6 +2818,95 @@ function color_graph_array($series_suffix, $compare = false){
//////////////////////////////////////////////////
// Color commented not to restrict serie colors //
//////////////////////////////////////////////////
$color_series = array();
$color_series[0] = array(
'border' => '#000000',
'color' => $config['graph_color1'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[1] = array(
'border' => '#000000',
'color' => $config['graph_color2'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[2] = array(
'border' => '#000000',
'color' => $config['graph_color3'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[3] = array(
'border' => '#000000',
'color' => $config['graph_color4'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[4] = array(
'border' => '#000000',
'color' => $config['graph_color5'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[5] = array(
'border' => '#000000',
'color' => $config['graph_color6'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[6] = array(
'border' => '#000000',
'color' => $config['graph_color7'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[7] = array(
'border' => '#000000',
'color' => $config['graph_color8'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[8] = array(
'border' => '#000000',
'color' => $config['graph_color9'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[9] = array(
'border' => '#000000',
'color' => $config['graph_color10'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[11] = array(
'border' => '#000000',
'color' => COL_GRAPH9,
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[12] = array(
'border' => '#000000',
'color' => COL_GRAPH10,
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[13] = array(
'border' => '#000000',
'color' => COL_GRAPH11,
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[14] = array(
'border' => '#000000',
'color' => COL_GRAPH12,
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[15] = array(
'border' => '#000000',
'color' => COL_GRAPH13,
'alpha' => CHART_DEFAULT_ALPHA
);
/*
if($id_widget_dashboard){
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $id_widget_dashboard)));
foreach ($module_list as $key => $value) {
if(!empty($opcion[$value])){
$color[$key]['color'] = $opcion[$value];
}
}
}
*/
if(!$compare) {
$color['event' . $series_suffix] =
array( 'border' => '#ff0000',
@ -2843,23 +2932,8 @@ function color_graph_array($series_suffix, $compare = false){
'alpha' => CHART_DEFAULT_ALPHA
);
$color['max'.$series_suffix] =
array( 'border' => '#000000',
'color' => $config['graph_color3'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color['sum'.$series_suffix] =
array( 'border' => '#000000',
'color' => $config['graph_color2'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color['min'.$series_suffix] =
array( 'border' => '#000000',
'color' => $config['graph_color1'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[$series_suffix];
$color['unit'.$series_suffix] =
array( 'border' => null,
@ -2898,23 +2972,8 @@ function color_graph_array($series_suffix, $compare = false){
'alpha' => CHART_DEFAULT_ALPHA
);
$color['max'.$series_suffix] =
array( 'border' => '#000000',
'color' => $config['graph_color3'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color['sum'.$series_suffix] =
array( 'border' => '#000000',
'color' => '#b781c1',
'alpha' => CHART_DEFAULT_ALPHA
);
$color['min'.$series_suffix] =
array( 'border' => '#000000',
'color' => $config['graph_color1'],
'alpha' => CHART_DEFAULT_ALPHA
);
$color_series[$series_suffix];
$color['unit'.$series_suffix] =
array( 'border' => null,
@ -2927,7 +2986,6 @@ function color_graph_array($series_suffix, $compare = false){
'color' => '#003333',
'alpha' => CHART_DEFAULT_ALPHA
);
}
return $color;
@ -2946,8 +3004,15 @@ function legend_graph_array(
global $legend;
$unit = $format_graph['unit'];
$legend['sum'.$series_suffix] =
$data_module_graph['module_name'] . ' ' .
if (isset($show_elements_graph['labels']) && is_array($show_elements_graph['labels'])){
$legend['sum'.$series_suffix] = $show_elements_graph['labels'][$data_module_graph['module_id']] . ' ' ;
}
else{
$legend['sum'.$series_suffix] = $data_module_graph['agent_name'] . ' / ' .
$data_module_graph['module_name'] . ': ';
}
$legend['sum'.$series_suffix] .=
__('Min:') . remove_right_zeros(
number_format(
$min,
@ -2977,13 +3042,25 @@ function legend_graph_array(
$legend['alert'.$series_suffix] = __('Alert') . ' ' . $series_suffix_str;
}
if($show_elements_graph['percentil']){
$legend['percentil'.$series_suffix] = __('Percentil') . ' Value: ' .
remove_right_zeros(
number_format(
$percentil_value,
$config['graph_precision']
)
) . ' ' . $series_suffix_str;
$legend['percentil'.$series_suffix] =
__('Percentil') . ' ' .
$config['percentil'] .
'º ' . __('of module') . ' ';
if (isset($show_elements_graph['labels']) && is_array($show_elements_graph['labels'])){
$legend['percentil'.$series_suffix] .= $show_elements_graph['labels'][$data_module_graph['module_id']] . ' ' ;
}
else{
$legend['percentil'.$series_suffix] .= $data_module_graph['agent_name'] . ' / ' .
$data_module_graph['module_name'] . ': ' . ' Value: ';
}
$legend['percentil'.$series_suffix] .= remove_right_zeros(
number_format(
$percentil_value,
$config['graph_precision']
)
) . ' ' . $series_suffix_str;
}
return $legend;

View File

@ -168,9 +168,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$dashboard = false, $vconsole = false, $percentil = null,
$from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
html_debug_print('esta en esta otro arch');
global $config;
if ($from_interface) {
if ($config["type_interface_charts"] == 'line') {
$graph_conf['stacked'] = CUSTOM_GRAPH_LINE;
@ -187,29 +186,29 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$graph_conf = db_get_row('tgraph', 'id_graph', $id_graph);
}
}
if ($stacked === null) {
$stacked = $graph_conf['stacked'];
}
$sources = false;
if ($id_graph == 0) {
$modules = $modules_param;
$count_modules = count($modules);
$weights = array_fill(0, $count_modules, 1);
if ($count_modules > 0)
$sources = true;
}
else {
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',
$id_graph);
$series = db_get_all_rows_sql('SELECT summatory_series,average_series,modules_series FROM tgraph WHERE id_graph = '.$id_graph);
$summatory = $series[0]['summatory_series'];
$average = $series[0]['average_series'];
$modules_series = $series[0]['modules_series'];
$modules = array ();
$weights = array ();
$labels = array ();
@ -224,22 +223,21 @@ function custom_graphs_print($id_graph, $height, $width, $period,
}
}
}
if ($sources === false) {
if ($return){
return false;
}
else{
else{
ui_print_info_message ( array ( 'no_close' => true, 'message' => __('No items.') ) );
return;
}
}
if (empty($homeurl)) {
$homeurl = ui_get_full_url(false, false, false, false);
}
$output = graphic_combined_module($modules,
$weights,
$period,
@ -273,8 +271,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$fullscale,
$summatory,
$average,
$modules_series);
$modules_series);
if ($return)
return $output;
echo $output;

File diff suppressed because it is too large Load Diff

View File

@ -204,8 +204,9 @@ function flot_area_graph (
break;
}
///XXXXXXX los px caca
// Parent layer
$return = "<div class='parent_graph' style='width: " . ($format_graph['width']) . "; " . $background_style . "'>";
$return = "<div class='parent_graph' style='width: " . ($format_graph['width']) . "px; " . $background_style . "'>";
// Set some containers to legend, graph, timestamp tooltip, etc.
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:" . $format_graph['font_size'] ."pt !important;'></p>";
@ -250,7 +251,7 @@ function flot_area_graph (
//XXXXXX height: ".$format_graph['height']."px;'
$return .= "graph" .$format_graph['adapt_key'] ."'
style=' width: ".$format_graph['width']."px;
height: 400px;'></div>";
height: ".$format_graph['height']."px;'></div>";
if ($show_elements_graph['menu']) {
$format_graph['height'] = 100;
@ -260,8 +261,7 @@ function flot_area_graph (
}
if (!$vconsole){
$return .= "<div id='overview_$graph_id'
class='overview_graph'
$return .= "<div id='overview_$graph_id' class='overview_graph'
style='margin:0px; margin-top:30px; margin-bottom:50px; display:none; width: ".$format_graph['width']."; height: 200px;'></div>";
}
@ -375,7 +375,7 @@ function menu_graph(
$return .= "<div id='geneal_menu_$graph_id' class='menu_graph' style='
width: 30px;
height: 250px;
left: 100%;
left:" . $width . "px;
position: absolute;
top: 0px;
background-color: white;'>";