--- ./popup.php.orig	2014-08-27 15:07:24.000000000 +0200
+++ ./popup.php	2014-08-31 15:19:29.000000000 +0200
@@ -1473,6 +1473,8 @@
 		$graphs = array();
 	}
 
+	$parentId = $dstfld1 ? zbx_jsvalue($dstfld1) : 'null';
+
 	foreach ($graphs as $graph) {
 		$host = reset($graph['hosts']);
 		$graph['hostname'] = $host['name'];
@@ -1480,7 +1482,7 @@
 		$graph['name'] = $graph['hostname'].NAME_DELIMITER.$graph['name'];
 
 		if ($multiselect) {
-			$js_action = 'javascript: addValue('.zbx_jsvalue($reference).', '.zbx_jsvalue($graph['graphid']).');';
+			$js_action = 'javascript: addValue('.zbx_jsvalue($reference).', '.zbx_jsvalue($graph['graphid']).', '.$parentId.');';
 		}
 		else {
 			$values = array(
@@ -1495,6 +1497,14 @@
 			$description = new CCol(array(new CCheckBox('graphs['.zbx_jsValue($graph[$srcfld1]).']', null, null, $graph['graphid']), $description));
 		}
 
+		$graphs[$graph['graphid']] = array_merge(
+			$graphs[$graph['graphid']],
+			array(
+				'id' => $graph['graphid'],
+				'prefix' => get_node_name_by_elid($graph['graphid'], null, NAME_DELIMITER)
+			)
+		);
+
 		switch ($graph['graphtype']) {
 			case GRAPH_TYPE_STACKED:
 				$graphtype = _('Stacked');
@@ -1517,7 +1527,7 @@
 	}
 
 	if ($multiselect) {
-		$button = new CButton('select', _('Select'), "javascript: addSelectedValues('graphs', ".zbx_jsvalue($reference).');');
+		$button = new CButton('select', _('Select'), "javascript: addSelectedValues('graphs', ".zbx_jsvalue($reference).', '.$parentId.');');
 		$table->setFooter(new CCol($button, 'right'));
 
 		insert_js('var popupReference = '.zbx_jsvalue($graphs, true).';');
--- ./styles/default.css.orig	2014-08-27 15:07:24.000000000 +0200
+++ ./styles/default.css	2014-08-31 15:26:52.000000000 +0200
@@ -321,6 +321,10 @@
 table.formtable tr td.form_row_l { width: 30%; }
 table.formtable tr td.form_row_c { text-align: center; }
 table.formtable tr td.form_row_r table.calendar tr td { padding-left: 1px; padding-right: 1px; }
+table.formtable tr td.form_row_r .multiselect { white-space: normal; }
+table.formtable tr td.form_row_r .multiselect ul { margin-top: 2px; margin-bottom: 2px; }
+table.formtable tr td.form_row_r .multiselect input { margin-top: 2px; }
+table.formtable tr td.form_row_r .filter-multiselect-select-button { height: 20px; margin-top: 2px; margin-left: 3px; }
 table.formlongtable { width: 99%; }
 
 /* form row */
--- ./jsrpc.php.orig	2014-08-27 15:07:26.000000000 +0200
+++ ./jsrpc.php	2014-08-31 15:19:29.000000000 +0200
@@ -413,6 +413,49 @@
 					}
 				}
 				break;
+
+			case 'graphs':
+				$graphs = API::Graph()->get(array(
+					'output' => array('graphid', 'name'),
+					'selectHosts' => array('name'),
+					'filter' => array(
+						'hostid' => isset($data['hostid']) ? $data['hostid'] : null
+						),
+					'search' => isset($data['search']) ? array('name' => $data['search']) : null,
+					'limit' => $config['search_limit']
+				));
+				if ($graphs) {
+					if ($displayNodes) {
+						foreach ($graphs as &$graph) {
+							$graph['nodename'] = get_node_name_by_elid($graph['graphid'], true, NAME_DELIMITER);
+						}
+						unset($graph);
+					}
+
+					$sortFields[] = array('field' => 'name', 'order' => ZBX_SORT_UP);
+					CArrayHelper::sort($graphs, $sortFields);
+
+					if (isset($data['limit'])) {
+						$graphs = array_slice($graphs, 0, $data['limit']);
+					}
+
+					foreach ($graphs as $graph) {
+						$hostName = '';
+
+						if (!isset($data['hostid']) && $graph['hosts']) {
+							$graph['hosts'] = reset($graph['hosts']);
+
+							$hostName = $graph['hosts']['name'].NAME_DELIMITER;
+						}
+
+						$result[] = array(
+							'id' => $graph['graphid'],
+							'prefix' => ($displayNodes ? $graph['nodename'] : '').$hostName,
+							'name' => $graph['name']
+						);
+					}
+				}
+				break;
 		}
 		break;
 
--- ./include/views/monitoring.charts.php.orig	2014-08-27 15:07:24.000000000 +0200
+++ ./include/views/monitoring.charts.php	2014-08-31 15:19:29.000000000 +0200
@@ -18,6 +18,52 @@
 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
 
+$filterForm = new CFormTable(null, null, 'get');
+$filterForm->setAttribute('name', 'zbx_filter');
+$filterForm->setAttribute('id', 'zbx_filter');
+
+$graphFilter = null;
+if (!empty($this->data['graphIds'])) {
+	$getGraphInfo = API::Graph()->get(array(
+		'graphids' => $this->data['graphIds'],
+		'output' => array('name')
+	));
+	if (!empty($getGraphInfo)) {
+		foreach ($getGraphInfo as $graphInfo) {
+			$graphFilter[] = array(
+				'id' => $graphInfo['graphid'],
+				'name' => $graphInfo['name']
+			);
+		}
+	}
+}
+
+$filterForm->addRow(new CRow(array(
+	new CCol(_('Graphs'), 'form_row_l'),
+	new CCol( new CMultiSelect(array(
+		'name' => 'filterGraphIds[]',
+		'objectName' => 'graphs',
+		'selectedLimit' => CWebUser::$data['rows_per_page'],
+		'objectOptions' => array(
+			'hostid' => $this->data['pageFilter']->hostid,
+		),
+		'data' => $graphFilter,
+		'popup' => array(
+			'parameters' => 'srctbl=graphs&dstfrm='.$filterForm->getName().
+				'&dstfld1=filterGraphIds_'.
+				'&srcfld1=graphid'.
+				'&multiselect=1'.
+				'&only_hostid='.$this->data['pageFilter']->hostid,
+			'width' => 800,
+			'height' => 450,
+			'buttonClass' => 'input filter-multiselect-select-button'
+		)
+	)), 'form_row_r')
+)));
+
+$filterForm->addItemToBottomRow(new CSubmit('filter_set', _('Filter')));
+$filterForm->addItemToBottomRow(new CButton('filter_rst', _('Reset'),
+	'javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst", 1); location.href = uri.getUrl();'));
 
 $chartsWidget = new CWidget('hat_charts');
 $chartForm = new CForm('get');
@@ -26,6 +72,10 @@
 $chartForm->addItem(array(SPACE._('Host').SPACE, $this->data['pageFilter']->getHostsCB(true)));
 $chartForm->addItem(array(SPACE._('Graph').SPACE, $this->data['pageFilter']->getGraphsCB(true)));
 
+if (empty($this->data['graphid']) && $this->data['pageFilter']->hostid != 0) {
+	$chartsWidget->addFlicker($filterForm, CProfile::get('web.charts.filter.state', 1));
+}
+
 $chartsWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.charts.filter.state', 1));
 
 if ($this->data['graphid']) {
@@ -68,6 +118,42 @@
 		'profileIdx' => $screen->profileIdx
 	));
 }
+else if ($this->data['pageFilter']->hostid != 0) {
+	$options = array(
+		'graphids' => $this->data['graphIds'],
+		'output' => array('graphid', 'name', 'graphtype'),
+		'hostids' => $this->data['pageFilter']->hostid,
+		'limit' => CWebUser::$data['rows_per_page']
+	);
+	$graphs = API::Graph()->get($options);
+
+	usort($graphs, function($a, $b) {
+		return strcmp(
+			( ($a['graphtype']<2) ? 0 : 1).$a['name'],
+			( ($b['graphtype']<2) ? 0 : 1).$b['name']
+		);
+	});
+
+	$chartTable = new CTable(_('No graphs defined.'), 'maxwidth');
+	foreach ($graphs as $graph) {
+		$graphid = $graph['graphid'];
+		$screen = CScreenBuilder::getScreen(array(
+			'resourcetype' => SCREEN_RESOURCE_CHART,
+			'graphid' => $graph['graphid'],
+			'profileIdx' => 'web.screens',
+			'profileIdx2' => $graph['graphid'],
+			'dataId' => 'graph_full_' . $graph['graphid']
+		));
+		$chartTable->addRow($screen->get());
+	}
+
+	$chartsWidget->addItem($chartTable);
+
+	CScreenBuilder::insertScreenStandardJs(array(
+		'timeline' => $screen->timeline,
+		'profileIdx' => $screen->profileIdx
+	));
+}
 else {
 	$screen = new CScreenBuilder();
 	CScreenBuilder::insertScreenStandardJs(array(
--- ./include/classes/screens/CScreenChart.php.orig	2014-08-27 15:07:24.000000000 +0200
+++ ./include/classes/screens/CScreenChart.php	2014-08-31 15:19:29.000000000 +0200
@@ -38,6 +38,7 @@
 		parent::__construct($options);
 
 		$this->graphid = isset($options['graphid']) ? $options['graphid'] : null;
+		$this->dataId = isset($options['dataId']) ? $options['dataId'] : null;
 	}
 
 	/**
@@ -46,7 +47,9 @@
 	 * @return CDiv (screen inside container)
 	 */
 	public function get() {
-		$this->dataId = 'graph_full';
+		if (empty($this->dataId)) {
+			$this->dataId = 'graph_full';
+		}
 		$containerId = 'graph_container';
 
 		// time control
--- ./charts.php.orig	2014-08-27 15:07:26.000000000 +0200
+++ ./charts.php	2014-08-31 15:19:29.000000000 +0200
@@ -26,7 +26,7 @@
 $page['title'] = _('Custom graphs');
 $page['file'] = 'charts.php';
 $page['hist_arg'] = array('hostid', 'groupid', 'graphid');
-$page['scripts'] = array('class.calendar.js', 'gtlc.js', 'flickerfreescreen.js');
+$page['scripts'] = array('class.calendar.js', 'gtlc.js', 'flickerfreescreen.js', 'multiselect.js');
 $page['type'] = detect_page_type(PAGE_TYPE_HTML);
 
 define('ZBX_PAGE_DO_JS_REFRESH', 1);
@@ -44,6 +44,8 @@
 	'stime' =>		array(T_ZBX_STR, O_OPT, P_SYS, null,		null),
 	'action' =>		array(T_ZBX_STR, O_OPT, P_SYS, IN("'go','add','remove'"), null),
 	'fullscreen' =>	array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'),	null),
+	'filter_rst'=>		array(T_ZBX_INT, O_OPT, P_SYS,	IN(array(0,1)), null),
+	'filterGraphIds' =>	array(T_ZBX_INT, O_OPT, null, null,		null),
 	// ajax
 	'favobj' =>		array(T_ZBX_STR, O_OPT, P_ACT, null,		null),
 	'favref' =>		array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY,	null),
@@ -146,12 +148,20 @@
 }
 
 /*
+ * Filter
+ */
+if (isset($_REQUEST['filter_rst'])) {
+	$_REQUEST['filterGraphIds'] = null;
+}
+
+/*
  * Display
  */
 $data = array(
 	'pageFilter' => $pageFilter,
 	'graphid' => $pageFilter->graphid,
-	'fullscreen' => $_REQUEST['fullscreen']
+	'fullscreen' => $_REQUEST['fullscreen'],
+	'graphIds' => get_request('filterGraphIds', null),
 );
 
 // render view
--- ./js/flickerfreescreen.js.orig	2014-08-27 15:07:24.000000000 +0200
+++ ./js/flickerfreescreen.js	2014-08-31 15:19:29.000000000 +0200
@@ -299,7 +299,7 @@
 						// re-refresh image
 						var bufferImg = $(this);
 
-						if (bufferImg.data('timestamp') > screen.timestamp) {
+						if (bufferImg.data('timestamp') + 1000 > screen.timestamp) {
 							screen.timestamp = bufferImg.data('timestamp');
 
 							// set id
