fixed errors agent access and other fix
This commit is contained in:
parent
5574ddd205
commit
6eba3250da
|
@ -2970,17 +2970,6 @@ function color_graph_array(){
|
|||
'color' => '#0097BC',
|
||||
'alpha' => 10
|
||||
);
|
||||
//XXXXXXXX
|
||||
/*
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return $color_series;
|
||||
}
|
||||
|
@ -3004,6 +2993,18 @@ function series_type_graph_array($data, $show_elements_graph){
|
|||
}
|
||||
|
||||
$color_series = color_graph_array();
|
||||
|
||||
if($show_elements_graph['id_widget_dashboard']){
|
||||
$opcion = unserialize(db_get_value_filter('options','twidget_dashboard',array('id' => $show_elements_graph['id_widget_dashboard'])));
|
||||
foreach ($opcion as $key => $value) {
|
||||
$color_series[0] = array(
|
||||
'border' => '#000000',
|
||||
'color' => $opcion['avg'],
|
||||
'alpha' => CHART_DEFAULT_ALPHA
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
if(isset($data) && is_array($data)){
|
||||
foreach ($data as $key => $value) {
|
||||
|
|
|
@ -870,8 +870,13 @@ function grafico_modulo_sparse ($params) {
|
|||
$params['graph_combined'] = false;
|
||||
}
|
||||
|
||||
//XXXX Configurable
|
||||
$params['grid_color'] = '#C1C1C1';
|
||||
$params['legend_color'] = '#636363';
|
||||
|
||||
$params['font'] = $config['fontpath'];
|
||||
$params['font-size'] = $config['font_size'];
|
||||
$params['short_data'] = $config['short_module_graph_data'];
|
||||
|
||||
if($params['only_image']){
|
||||
return generator_chart_to_pdf('sparse', $params);
|
||||
|
@ -1228,7 +1233,6 @@ function graphic_combined_module (
|
|||
$params_combined['percentil'] = $params['percentil'];
|
||||
}
|
||||
|
||||
|
||||
if(!isset($params['period'])){
|
||||
return false;
|
||||
}
|
||||
|
@ -2267,24 +2271,6 @@ function combined_graph_summatory_average ($array_data, $average = false, $summa
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Print a graph with access data of agents
|
||||
*
|
||||
|
@ -2308,7 +2294,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
|
|||
WHERE id_agent = $id_agent
|
||||
AND utimestamp > $datelimit
|
||||
AND utimestamp < $date
|
||||
GROUP by ROUND(utimestamp / 300)"
|
||||
GROUP by ROUND(utimestamp / 1800)"
|
||||
);
|
||||
|
||||
if(isset($data) && is_array($data)){
|
||||
|
@ -2342,14 +2328,16 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
|
|||
'only_image' => $only_image,
|
||||
'homeurl' => $homeurl,
|
||||
'menu' => true,
|
||||
'backgroundColor' => 'white',
|
||||
'backgroundColor' => '#f9faf9',
|
||||
'type_graph' => 'area',
|
||||
'font' => $config['fontpath'],
|
||||
'font-size' => $config['font_size'],
|
||||
'array_data_create' => $data_array,
|
||||
'show_overview' => false,
|
||||
'show_export_csv' => false,
|
||||
'vconsole' => $tree
|
||||
'vconsole' => true,
|
||||
'show_legend' => false,
|
||||
'grid_color' => 'grey'
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
|
|
|
@ -729,7 +729,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
if ($config["agentaccess"]) {
|
||||
$access_graph = '<div>hjhhjhhj</div>';
|
||||
$access_graph = '<div style="width:100%; heigth:200px;">';
|
||||
$access_graph .= graphic_agentaccess($id_agente, 380, 180, SECONDS_1DAY, true, true);
|
||||
$access_graph .= graphic_agentaccess($id_agente, 380, 90, SECONDS_1DAY, true, true);
|
||||
$access_graph .= '</div><br><br>';
|
||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||
}
|
||||
|
|
|
@ -855,29 +855,33 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
}
|
||||
}
|
||||
|
||||
function pandoraFlotArea(
|
||||
graph_id, values, legend, agent_module_id,
|
||||
function pandoraFlotArea( graph_id, values, legend,
|
||||
series_type, color, water_mark, date_array,
|
||||
data_module_graph, params,
|
||||
force_integer, background_color,
|
||||
legend_color, short_data, events_array
|
||||
data_module_graph, params, events_array
|
||||
) {
|
||||
|
||||
//diferents vars
|
||||
var unit = params.unit ? params.unit : '';
|
||||
var homeurl = params.homeurl;
|
||||
var font_size = params.font_size;
|
||||
var font = params.font;
|
||||
var width = params.width;
|
||||
var height = params.height;
|
||||
var vconsole = params.vconsole;
|
||||
var dashboard = params.dashboard;
|
||||
var menu = params.menu;
|
||||
var min_x = date_array['start_date'] *1000;
|
||||
var max_x = date_array['final_date'] *1000;
|
||||
var type = params.stacked;
|
||||
var show_legend = params.show_legend;
|
||||
var image_treshold = params.image_treshold;
|
||||
var unit = params.unit ? params.unit : '';
|
||||
var homeurl = params.homeurl;
|
||||
var font_size = params.font_size;
|
||||
var font = params.font;
|
||||
var width = params.width;
|
||||
var height = params.height;
|
||||
var vconsole = params.vconsole;
|
||||
var dashboard = params.dashboard;
|
||||
var menu = params.menu;
|
||||
var min_x = date_array['start_date'] *1000;
|
||||
var max_x = date_array['final_date'] *1000;
|
||||
var type = params.stacked;
|
||||
var show_legend = params.show_legend;
|
||||
var image_treshold = params.image_treshold;
|
||||
var short_data = params.short_data;
|
||||
var grid_color = params.grid_color;
|
||||
var background_color = params.backgroundColor;
|
||||
var legend_color = params.legend_color;
|
||||
|
||||
//XXXXXX colocar
|
||||
var force_integer = 0;
|
||||
|
||||
if(typeof type === 'undefined' || type == ''){
|
||||
type = params.type_graph;
|
||||
|
@ -1594,7 +1598,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
var maxticks = date_array['period'] / 3600 / number_ticks;
|
||||
|
||||
console.log(grid_color);
|
||||
var options = {
|
||||
series: {
|
||||
stack: stacked,
|
||||
|
@ -1618,8 +1622,8 @@ function pandoraFlotArea(
|
|||
clickable: true,
|
||||
borderWidth:1,
|
||||
borderColor: '#C1C1C1',
|
||||
tickColor: background_color,
|
||||
color: legend_color,
|
||||
backgroundColor: background_color,
|
||||
color: grid_color,
|
||||
autoHighlight: true
|
||||
},
|
||||
xaxis: {
|
||||
|
@ -1677,7 +1681,7 @@ function pandoraFlotArea(
|
|||
}
|
||||
}
|
||||
|
||||
/*//XXXXXXX
|
||||
/*//XXXXXXXREvisar esto
|
||||
if (vconsole) {
|
||||
var myCanvas = plot.getCanvas();
|
||||
plot.setupGrid(); // redraw plot to new size
|
||||
|
@ -1696,7 +1700,6 @@ if (vconsole) {
|
|||
});
|
||||
|
||||
// Adjust linked graph to the width and position of the main plot
|
||||
|
||||
// Miniplot
|
||||
if (!vconsole) {
|
||||
var overview = $.plot($('#overview_'+graph_id),datas, {
|
||||
|
@ -1722,7 +1725,7 @@ if (vconsole) {
|
|||
borderWidth:1,
|
||||
borderColor: '#C1C1C1',
|
||||
tickColor: background_color,
|
||||
color: legend_color,
|
||||
color: grid_color,
|
||||
autoHighlight: true
|
||||
},
|
||||
xaxis: {
|
||||
|
@ -1757,6 +1760,8 @@ if (vconsole) {
|
|||
});
|
||||
}
|
||||
|
||||
$('#legend_' + graph_id + ' .legendLabel').css('color', legend_color);
|
||||
|
||||
// Adjust overview when main chart is resized
|
||||
$('#overview_'+graph_id).resize(function(){
|
||||
update_left_width_canvas(graph_id);
|
||||
|
@ -1994,7 +1999,7 @@ if (vconsole) {
|
|||
.eq(i).css('font-size',font_size+'pt');
|
||||
|
||||
$('#legend_' + graph_id + ' .legendLabel')
|
||||
.eq(i).css('color','');
|
||||
.eq(i).css('color', legend_color);
|
||||
|
||||
$('#legend_' + graph_id + ' .legendLabel')
|
||||
.eq(i).css('font-family',font+'Font');
|
||||
|
|
|
@ -117,15 +117,19 @@ function flot_area_graph (
|
|||
switch ($params['backgroundColor']) {
|
||||
case 'white':
|
||||
$background_style = ' background: #fff; ';
|
||||
$params['grid_color'] = '#C1C1C1';
|
||||
break;
|
||||
case 'black':
|
||||
$background_style = ' background: #000; ';
|
||||
$params['grid_color'] = '#BDBDBD';
|
||||
break;
|
||||
case 'transparent':
|
||||
$background_style = '';
|
||||
$params['grid_color'] = '#A4A4A4';
|
||||
break;
|
||||
default:
|
||||
$background_style = 'background-color: ' . $params['backgroundColor'];
|
||||
$params['grid_color'] = '#C1C1C1';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -243,29 +247,13 @@ function flot_area_graph (
|
|||
background:#fff; padding: 2px 2px 2px 2px;
|
||||
border: solid #000 1px;'></div>";
|
||||
|
||||
if(substr($background_style, -6, 4) == '#fff'){
|
||||
$background_color = "#eee";
|
||||
$legend_color = "#151515";
|
||||
}
|
||||
else if(substr($background_style, -6, 4) == '#000'){
|
||||
$background_color = "#151515";
|
||||
$legend_color = "#BDBDBD";
|
||||
}
|
||||
else{
|
||||
$background_color = "#A4A4A4";
|
||||
$legend_color = "#A4A4A4";
|
||||
}
|
||||
|
||||
$force_integer = 0;
|
||||
|
||||
// Trick to get translated string from javascript
|
||||
$return .= html_print_input_hidden('unknown_text', __('Unknown'), true);
|
||||
|
||||
if (!isset($config["short_module_graph_data"])){
|
||||
$config["short_module_graph_data"] = '';
|
||||
}
|
||||
|
||||
$short_data = $config["short_module_graph_data"];
|
||||
//XXXX Meter en params
|
||||
/*
|
||||
mirar tmb lo de force integer
|
||||
*/
|
||||
|
||||
$values = json_encode($array_data);
|
||||
$legend = json_encode($legend);
|
||||
|
@ -284,17 +272,12 @@ function flot_area_graph (
|
|||
"'$graph_id', \n" .
|
||||
"JSON.parse('$values'), \n" .
|
||||
"JSON.parse('$legend'), \n" .
|
||||
"'$agent_module_id', \n" .
|
||||
"JSON.parse('$series_type'), \n" .
|
||||
"JSON.parse('$color'), \n" .
|
||||
"'$watermark', \n" .
|
||||
"JSON.parse('$date_array'), \n" .
|
||||
"JSON.parse('$data_module_graph'), \n" .
|
||||
"JSON.parse('$params'), \n" .
|
||||
"$force_integer, \n" .
|
||||
"'$background_color', \n" .
|
||||
"'$legend_color', \n" .
|
||||
"'$short_data', \n" .
|
||||
"JSON.parse('$array_events_alerts')".
|
||||
");";
|
||||
$return .= "});";
|
||||
|
|
|
@ -284,7 +284,7 @@ if ($config["agentaccess"] && $access_agent > 0) {
|
|||
<legend>' .
|
||||
__('Agent access rate (24h)') .
|
||||
'</legend>' .
|
||||
graphic_agentaccess($id_agente, '90%', 150, SECONDS_1DAY, true) .
|
||||
graphic_agentaccess($id_agente, '95%', 100, SECONDS_1DAY, true) .
|
||||
'</fieldset>';
|
||||
$table_data->style[0] = 'width: 20%;';
|
||||
$table_data->style[1] = 'width: 30%;';
|
||||
|
|
Loading…
Reference in New Issue