diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 889d1d461b..58c7490618 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -231,14 +231,14 @@ function update_button_palette_callback() { break; case 'box_item': - if($('input[name=width_box]').val() == ''){ - alert('Undefined width'); - return false; - } - if($('input[name=height_box]').val() == ''){ - alert('Undefined height'); - return false; - } + if($('input[name=width_box]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height_box]').val() == ''){ + alert('Undefined height'); + return false; + } $("#" + idItem + " div").css('background-color', values['fill_color']); $("#" + idItem + " div").css('border-color', values['border_color']); @@ -256,55 +256,53 @@ function update_button_palette_callback() { case 'group_item': case 'static_graph': - if($('input[name=width]').val() == ''){ - alert('Undefined width'); - return false; - } - if($('input[name=height]').val() == ''){ - alert('Undefined height'); - return false; - } - - $("#text_" + idItem).html(values['label']); - if ((values['width'] == 0) || (values['height'] == 0)) { - if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ - $("#image_" + idItem).removeAttr('width'); - $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', 70); - $("#image_" + idItem).attr('height', 70); - $("#image_" + idItem).css('width', '70px'); - $("#image_" + idItem).css('height', '70px'); + if($('input[name=width]').val() == ''){ + alert('Undefined width'); + return false; } - else{ + if($('input[name=height]').val() == ''){ + alert('Undefined height'); + return false; + } + + $("#text_" + idItem).html(values['label']); + if ((values['width'] == 0) || (values['height'] == 0)) { + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + } + else{ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); + $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); + } + } + else { $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); - $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); - } - } - else { - $("#image_" + idItem).removeAttr('width'); - $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', values['width']); - $("#image_" + idItem).attr('height', values['height']); - $("#image_" + idItem).css('width', values['width'] + 'px'); - $("#image_" + idItem).css('height', values['height'] + 'px'); - } + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); + } break; case 'percentile_bar': case 'percentile_item': - - if($('input[name=width_percentile]').val() == ''){ - alert('Undefined width'); - return false; - } - if($('input[name=height_percentile]').val() == ''){ - alert('Undefined height'); - return false; - } - + if($('input[name=width_percentile]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height_percentile]').val() == ''){ + alert('Undefined height'); + return false; + } $("#text_" + idItem).html(values['label']); $("#image_" + idItem).attr("src", "images/spinner.gif"); @@ -315,50 +313,57 @@ function update_button_palette_callback() { setPercentileBar(idItem, values); } - - break; case 'module_graph': - - - if($('#dir_items').html() == 'horizontal'){ - if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width')) - || parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){ - - alert($('#count_items').html()+' joined graph items are wider than background'); - return false; - + if($('#dir_items').html() == 'horizontal'){ + if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width')) + || parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){ + + alert($('#count_items').html()+' joined graph items are wider than background'); + return false; + + } } - } - - if($('#dir_items').html() == 'vertical'){ - if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){ - alert($('#count_items').html()+' joined graph items are higher than background'); - return false; - + + if($('#dir_items').html() == 'vertical'){ + if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){ + alert($('#count_items').html()+' joined graph items are higher than background'); + return false; + + } } - } - - - if($('input[name=width_module_graph]').val() == ''){ - alert('Undefined width'); - return false; - } - if($('input[name=height_module_graph]').val() == ''){ - alert('Undefined height'); - return false; - } - if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){ + + if($('input[name=width_module_graph]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height_module_graph]').val() == ''){ + alert('Undefined height'); + return false; + } + if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){ alert('Undefined graph'); - return false; - } - - + return false; + } $("#text_" + idItem).html(values['label']); $("#image_" + idItem).attr("src", "images/spinner.gif"); setModuleGraph(idItem); break; + case 'auto_sla_graph': + if($('input[name=width]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height]').val() == ''){ + alert('Undefined height'); + return false; + } + $("#text_" + idItem).html(values['label']); + $("#image_" + idItem).attr("src", "images/spinner.gif"); + + setEventsBar(idItem, values); + break; case 'simple_value': $("#text_" + idItem).html(values['label']); //$("#simplevalue_" + idItem) @@ -369,42 +374,41 @@ function update_button_palette_callback() { $("#text_" + idItem).html(values['label']); break; case 'icon': - - if($('input[name=width]').val() == ''){ - alert('Undefined width'); - return false; - } - if($('input[name=height]').val() == ''){ - alert('Undefined height'); - return false; - } - $("#image_" + idItem).attr('src', "images/spinner.gif"); - if ((values['width'] == 0) || (values['height'] == 0)) { - if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + if($('input[name=width]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height]').val() == ''){ + alert('Undefined height'); + return false; + } + $("#image_" + idItem).attr('src', "images/spinner.gif"); + if ((values['width'] == 0) || (values['height'] == 0)) { + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + } + else{ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); + $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); + } + } + else { $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', 70); - $("#image_" + idItem).attr('height', 70); - $("#image_" + idItem).css('width', '70px'); - $("#image_" + idItem).css('height', '70px'); - } - else{ - $("#image_" + idItem).removeAttr('width'); - $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); - $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); - } - } - else { - $("#image_" + idItem).removeAttr('width'); - $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', values['width']); - $("#image_" + idItem).attr('height', values['height']); - $("#image_" + idItem).css('width', values['width'] + 'px'); - $("#image_" + idItem).css('height', values['height'] + 'px'); - } + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); + } var image = values['image'] + ".png"; set_image("image", idItem, image); break; @@ -872,6 +876,7 @@ function toggle_item_palette() { activeToolboxButton('group_item', true); activeToolboxButton('box_item', true); activeToolboxButton('line_item', true); + activeToolboxButton('auto_sla_graph', true); if (typeof(enterprise_activeToolboxButton) == 'function') { enterprise_activeToolboxButton(true); @@ -891,6 +896,7 @@ function toggle_item_palette() { activeToolboxButton('static_graph', false); activeToolboxButton('module_graph', false); + activeToolboxButton('auto_sla_graph', false); activeToolboxButton('simple_value', false); activeToolboxButton('label', false); activeToolboxButton('icon', false); @@ -1023,6 +1029,8 @@ function loadFieldsFromDB(item) { fill_parent_select(idItem); jQuery.each(data, function(key, val) { + if (key == 'event_max_time_row') + $("select[name=event_max_time_row]").val(val); if (key == 'background') $("#background_image").val(val); if (key == 'width') $("input[name=width]").val(val); @@ -2478,13 +2486,13 @@ function updateDB_visual(type, idElement , values, event, top, left) { set_static_graph_status(idElement, values['image']); } + break; case 'percentile_item': case 'simple_value': case 'label': case 'icon': case 'module_graph': - - + case 'auto_sla_graph': if (type == 'simple_value') { setModuleValue(idElement, values.process_simple_value, @@ -2708,8 +2716,6 @@ function updateDB(type, idElement , values, event) { function copyDB(idItem) { metaconsole = $("input[name='metaconsole']").val(); - - parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "copy"}); @@ -2880,6 +2886,15 @@ function eventsItems(drag) { activeToolboxButton('delete_item', true); activeToolboxButton('show_grid', false); } + if ($(divParent).hasClass('auto_sla_graph')) { + creationItem = null; + selectedItem = 'auto_sla_graph'; + idItem = $(divParent).attr('id'); + activeToolboxButton('copy_item', true); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + activeToolboxButton('show_grid', false); + } if ($(divParent).hasClass('group_item')) { creationItem = null; selectedItem = 'group_item'; @@ -2987,6 +3002,9 @@ function eventsItems(drag) { if ($(event.target).hasClass('static_graph')) { selectedItem = 'static_graph'; } + if ($(event.target).hasClass('auto_sla_graph')) { + selectedItem = 'auto_sla_graph'; + } if ($(event.target).hasClass('group_item')) { selectedItem = 'group_item'; } @@ -3344,7 +3362,7 @@ function click_button_toolbox(id) { activeToolboxButton('icon', false); activeToolboxButton('service', false); activeToolboxButton('group_item', false); - + activeToolboxButton('auto_sla_graph', false); activeToolboxButton('copy_item', false); activeToolboxButton('edit_item', false); activeToolboxButton('delete_item', false); @@ -3374,6 +3392,7 @@ function click_button_toolbox(id) { activeToolboxButton('label', true); activeToolboxButton('icon', true); activeToolboxButton('group_item', true); + activeToolboxButton('auto_sla_graph', true); } break; case 'save_visualmap': diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index e7f423732f..9738d9150d 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -456,12 +456,14 @@ switch ($action) { $process_simple_value); $values['period'] = $period; } + break; case 'percentile_bar': case 'percentile_item': case 'static_graph': case 'module_graph': case 'label': case 'icon': + case 'auto_sla_graph': default: if ($type == 'label') { $values['type'] = LABEL; @@ -536,6 +538,18 @@ switch ($action) { $values['border_color'] = $line_color; break; // ------------------------------------------------- + case 'auto_sla_graph': + $values['type'] = AUTO_SLA_GRAPH; + if ($event_max_time_row !== null) { + $values['period'] = $event_max_time_row; + } + if ($width !== null) { + $values['width'] = $width; + } + if ($height !== null) { + $values['height'] = $height; + } + break; case 'box_item': $values['border_width'] = $border_width; $values['border_color'] = $border_color; @@ -654,7 +668,7 @@ switch ($action) { if (($item_in_db['parent_item'] == 0) && ($values['parent_item'] != 0)) { $new_line = 1; } - + $result = db_process_sql_update('tlayout_data', $values, array('id' => $id_element)); @@ -691,6 +705,7 @@ switch ($action) { case 'simple_value': case 'label': case 'icon': + case 'auto_sla_graph': $elementFields = db_get_row_filter('tlayout_data', array('id' => $id_element)); @@ -742,6 +757,8 @@ switch ($action) { } switch ($type) { + case 'auto_sla_graph': + $elementFields['event_max_time_row'] = $elementFields['period']; case 'percentile_item': case 'percentile_bar': $elementFields['width_percentile'] = $elementFields['width']; @@ -1022,8 +1039,6 @@ switch ($action) { echo json_encode($return); break; - - case 'delete': if (db_process_sql_delete('tlayout_data', array('id' => $id_element, 'id_layout' => $id_visual_console)) === false) { $return['correct'] = 0; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index fd81e15d6d..8bed46cbcc 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -156,6 +156,7 @@ function visual_map_print_item($mode = "read", $layoutData, $wimg ='70'; break; case 3: + case 14: if (get_parameter('action') == 'edit') { $himg = '30'; $wimg = '150'; @@ -1066,8 +1067,6 @@ function visual_map_print_item($mode = "read", $layoutData, metaconsole_restore_db(); } - //$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img); - break; case LABEL: $z_index = 4 + 1; @@ -1096,10 +1095,30 @@ function visual_map_print_item($mode = "read", $layoutData, } else { if ($width == 0 || $height == 0) { - $img = graph_graphic_agentevents ($layoutData['id_agent'], 500, 50, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + if ($layoutData['label_position']=='left') { + $img = '
' . + $img = graph_graphic_agentevents ($layoutData['id_agent'], 500, 50, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + } + elseif ($layoutData['label_position']=='right') { + $img = '
' . + $img = graph_graphic_agentevents ($layoutData['id_agent'], 500, 50, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + } + else { + $img = graph_graphic_agentevents ($layoutData['id_agent'], 500, 50, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + } } else{ - $img = graph_graphic_agentevents ($layoutData['id_agent'], $width, $height, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + if ($layoutData['label_position']=='left') { + $img = '
' . + $img = graph_graphic_agentevents ($layoutData['id_agent'], $width, $height, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + } + elseif ($layoutData['label_position']=='right') { + $img = '
' . + $img = graph_graphic_agentevents ($layoutData['id_agent'], $width, $height, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + } + else { + $img = graph_graphic_agentevents ($layoutData['id_agent'], $width, $height, $layoutData['period'], '', true, $layoutData['id_agente_modulo']); + } } } @@ -1111,7 +1130,7 @@ function visual_map_print_item($mode = "read", $layoutData, $z_index = 2 + 1; break; } - html_debug(get_parameter('action'), true); + $class = "item "; switch ($type) { case STATIC_GRAPH: @@ -1454,7 +1473,18 @@ function visual_map_print_item($mode = "read", $layoutData, } break; case AUTO_SLA_GRAPH: + if ($layoutData['label_position']=='up') { + echo io_safe_output($text); + } + echo $img; + + if ($layoutData['label_position']=='down') { + echo io_safe_output($text); + } + elseif($layoutData['label_position']=='left' || $layoutData['label_position']=='right') { + echo io_safe_output($text); + } break; case SIMPLE_VALUE: case SIMPLE_VALUE_MAX: @@ -1484,42 +1514,12 @@ function visual_map_print_item($mode = "read", $layoutData, $layoutData['id_agente_modulo'], $period); global $config; - - if ($type == SIMPLE_VALUE) { - //~ $returnValue_value = explode(' ', $value); - - //~ if ($returnValue_value[1] != "") { - //~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1]; - //~ } - //~ else { - //~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])); - //~ } - - } - else { - // If the value is a string, dont format it - if (!is_string($value)) { - //~ $value = remove_right_zeros(format_for_graph($value, $config['graph_precision'])); - } - } - - //$io_safe_output_text = str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text); - - - if(get_parameter('action') == 'edit'){ - - //echo 'Data value'; - - echo $io_safe_output_text; - - } + echo $io_safe_output_text; + } else{ - - echo str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text); - - } - + echo str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text); + } //Restore db connection if ($layoutData['id_metaconsole'] != 0) { @@ -2931,6 +2931,9 @@ function visual_map_type_in_js($type) { case MODULE_GRAPH: return 'module_graph'; break; + case AUTO_SLA_GRAPH: + return 'auto_sla_graph'; + break; case SIMPLE_VALUE: return 'simple_value'; break; diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 5f8e43f3f6..a97055c8f3 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -154,7 +154,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { html_print_input_text('height_module_graph', 180, '', 3, 5, true) . ''; - $form_items['label_row'] = array(); $form_items['label_row']['items'] = array('label', 'static_graph', @@ -163,7 +162,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'module_graph', 'simple_value', 'datos', - 'group_item'); + 'group_item', + 'auto_sla_graph'); $form_items['label_row']['html'] = '' . __('Label') . ' @@ -540,7 +540,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items_advance['parent_row']['items'] = array( 'group_item', 'static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'label', 'icon', 'datos'); + 'simple_value', 'label', 'icon', 'datos', 'auto_sla_graph'); $form_items_advance['parent_row']['html'] = '' . __('Parent') . ' ' . diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 5595b93f5b..7e2950f806 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -635,7 +635,11 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul var stack = 0, bars = true, lines = false, steps = false; - var options = { + var regex = /visual_console/; + var match = regex.exec(window.location.href); + + if (match == null) { + var options = { series: { stack: stack, shadowSize: 0.1, @@ -662,51 +666,81 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul show: false } }; + } + else { + var options = { + series: { + stack: stack, + shadowSize: 0.1, + color: '#ddd' + }, + grid: { + hoverable: false, + clickable: false, + borderWidth:1, + borderColor: '', + tickColor: '#fff' + }, + xaxes: [ { + tickFormatter: xFormatter, + color: '', + tickSize: intervaltick, + tickLength: 0 + } ], + yaxes: [ { + show: false, + tickLength: 0 + }], + legend: { + show: false + } + }; + } var plot = $.plot($('#'+graph_id), datas, options ); - // Events - $('#'+graph_id).bind('plothover', function (event, pos, item) { - if (item) { - var from = legend[item.seriesIndex]; - var to = legend[item.seriesIndex+1]; + if (match == null) { + // Events + $('#'+graph_id).bind('plothover', function (event, pos, item) { + if (item) { + var from = legend[item.seriesIndex]; + var to = legend[item.seriesIndex+1]; - if (to == undefined) { - to = '>'; + if (to == undefined) { + to = '>'; + } + + $('#extra_'+graph_id).text(from+'-'+to); + var extra_height = parseInt($('#extra_'+graph_id).css('height').split('px')[0]); + var extra_width = parseInt($('#extra_'+graph_id).css('width').split('px')[0]); + $('#extra_'+graph_id).css('left',pos.pageX-(extra_width/4)+'px'); + //$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px'); + $('#extra_'+graph_id).show(); } + }); - $('#extra_'+graph_id).text(from+'-'+to); - var extra_height = parseInt($('#extra_'+graph_id).css('height').split('px')[0]); - var extra_width = parseInt($('#extra_'+graph_id).css('width').split('px')[0]); - $('#extra_'+graph_id).css('left',pos.pageX-(extra_width/4)+'px'); - //$('#extra_'+graph_id).css('top',plot.offset().top-extra_height-5+'px'); - $('#extra_'+graph_id).show(); - } - }); + $('#'+graph_id).bind('plotclick', function(event, pos, item) { + if (item) { + //from time + var from = legend[item.seriesIndex]; + //to time + var to = legend[item.seriesIndex+1]; + //current date + var dateObj = new Date(); + var month = dateObj.getUTCMonth() + 1; //months from 1-12 + var day = dateObj.getUTCDate(); + var year = dateObj.getUTCFullYear(); + newdate = year + "/" + month + "/" + day; - $('#'+graph_id).bind('plotclick', function(event, pos, item) { - if (item) { - //from time - var from = legend[item.seriesIndex]; - //to time - var to = legend[item.seriesIndex+1]; - //current date - var dateObj = new Date(); - var month = dateObj.getUTCMonth() + 1; //months from 1-12 - var day = dateObj.getUTCDate(); - var year = dateObj.getUTCFullYear(); - newdate = year + "/" + month + "/" + day; - - if(!to){ - to= '23:59'; + if(!to){ + to= '23:59'; + } + window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1'; } - window.location='index.php?sec=eventos&sec2=operation/events/events&id_agent='+id_agent+'&date_from='+newdate+'&time_from='+from+'&date_to='+newdate+'&time_to='+to+'&status=-1'; - } - }); + }); - - - $('#'+graph_id).bind('mouseout',resetInteractivity); + $('#'+graph_id).bind('mouseout',resetInteractivity); + } // Reset interactivity styles function resetInteractivity() {