diff --git a/api/classes/class.cgraph.php b/api/classes/class.cgraph.php
index 5848854..82ea64a 100644
--- a/api/classes/class.cgraph.php
+++ b/api/classes/class.cgraph.php
@@ -723,10 +723,16 @@ COpt::memoryPick();
 		if(isset($graph['height'])) $values['height'] = $graph['height'];
 		if(isset($graph['ymin_type'])) $values['ymin_type'] = $graph['ymin_type'];
 		if(isset($graph['ymax_type'])) $values['ymax_type'] = $graph['ymax_type'];
+		if(isset($graph['ymin_type2'])) $values['ymin_type2'] = $graph['ymin_type2'];
+		if(isset($graph['ymax_type2'])) $values['ymax_type2'] = $graph['ymax_type2'];
 		if(isset($graph['yaxismin'])) $values['yaxismin'] = $graph['yaxismin'];
 		if(isset($graph['yaxismax'])) $values['yaxismax'] = $graph['yaxismax'];
+		if(isset($graph['yaxismin2'])) $values['yaxismin2'] = $graph['yaxismin2'];
+		if(isset($graph['yaxismax2'])) $values['yaxismax2'] = $graph['yaxismax2'];
 		if(isset($graph['ymin_itemid'])) $values['ymin_itemid'] = $graph['ymin_itemid'];
 		if(isset($graph['ymax_itemid'])) $values['ymax_itemid'] = $graph['ymax_itemid'];
+		if(isset($graph['ymin_itemid2'])) $values['ymin_itemid2'] = $graph['ymin_itemid2'];
+		if(isset($graph['ymax_itemid2'])) $values['ymax_itemid2'] = $graph['ymax_itemid2'];
 		if(isset($graph['show_work_period'])) $values['show_work_period'] = $graph['show_work_period'];
 		if(isset($graph['show_triggers'])) $values['show_triggers'] = $graph['show_triggers'];
 		if(isset($graph['graphtype'])) $values['graphtype'] = $graph['graphtype'];
@@ -1115,6 +1121,12 @@ COpt::memoryPick();
 		if(isset($graph['ymax_type']) && $graph['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
 			$axis_items[$graph['ymax_itemid']] = $graph['ymax_itemid'];
 		}
+		if(isset($graph['ymin_type2']) && ($graph['ymin_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE)){
+			$axis_items[$graph['ymin_itemid2']] = $graph['ymin_itemid2'];
+		}
+		if(isset($graph['ymax_type2']) && $graph['ymax_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+			$axis_items[$graph['ymax_itemid2']] = $graph['ymax_itemid2'];
+		}
 
 		if(!empty($axis_items)){
 			$cnt = count($axis_items);
diff --git a/chart2.php b/chart2.php
index 0bcea05..a216cc7 100644
--- a/chart2.php
+++ b/chart2.php
@@ -98,12 +98,18 @@ include_once('include/page_header.php');
 
 	$graph->setYMinAxisType($db_data['ymin_type']);
 	$graph->setYMaxAxisType($db_data['ymax_type']);
+	$graph->setYMinAxisType2($db_data['ymin_type2']);
+	$graph->setYMaxAxisType2($db_data['ymax_type2']);
 
 	$graph->setYAxisMin($db_data['yaxismin']);
 	$graph->setYAxisMax($db_data['yaxismax']);
+	$graph->setYAxisMin2($db_data['yaxismin2']);
+	$graph->setYAxisMax2($db_data['yaxismax2']);
 
 	$graph->setYMinItemId($db_data['ymin_itemid']);
 	$graph->setYMaxItemId($db_data['ymax_itemid']);
+	$graph->setYMinItemId2($db_data['ymin_itemid2']);
+	$graph->setYMaxItemId2($db_data['ymax_itemid2']);
 
 	$graph->setLeftPercentage($db_data['percent_left']);
 	$graph->setRightPercentage($db_data['percent_right']);
diff --git a/chart3.php b/chart3.php
index ab83585..b2228b0 100644
--- a/chart3.php
+++ b/chart3.php
@@ -44,9 +44,13 @@ include_once('include/page_header.php');
 
 		'ymin_type'=>	array(T_ZBX_INT, O_OPT,	NULL,		IN('0,1,2'),		null),
 		'ymax_type'=>	array(T_ZBX_INT, O_OPT,	NULL,		IN('0,1,2'),		null),
+		'ymin_type2'=>	array(T_ZBX_INT, O_OPT,	NULL,		IN('0,1,2'),		null),
+		'ymax_type2'=>	array(T_ZBX_INT, O_OPT,	NULL,		IN('0,1,2'),		null),
 
 		'ymin_itemid'=>	array(T_ZBX_INT, O_OPT,	NULL,		DB_ID,	null),
 		'ymax_itemid'=>	array(T_ZBX_INT, O_OPT,	NULL,		DB_ID,	null),
+		'ymin_itemid2'=>	array(T_ZBX_INT, O_OPT,	NULL,		DB_ID,	null),
+		'ymax_itemid2'=>	array(T_ZBX_INT, O_OPT,	NULL,		DB_ID,	null),
 
 		'legend'=>	array(T_ZBX_INT, O_OPT,	 NULL,	IN('0,1'),	NULL),
 		'showworkperiod'=>	array(T_ZBX_INT, O_OPT,	 NULL,	IN('0,1'),	NULL),
@@ -56,6 +60,8 @@ include_once('include/page_header.php');
 
 		'yaxismin'=>	array(T_ZBX_DBL, O_OPT,	NULL,		null,	null),
 		'yaxismax'=>	array(T_ZBX_DBL, O_OPT,	NULL,		null,	null),
+		'yaxismin2'=>	array(T_ZBX_DBL, O_OPT,	NULL,		null,	null),
+		'yaxismax2'=>	array(T_ZBX_DBL, O_OPT,	NULL,		null,	null),
 
 		'percent_left'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	BETWEEN(0,100),	null),
 		'percent_right'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	BETWEEN(0,100),	null),
@@ -143,12 +149,18 @@ include_once('include/page_header.php');
 
 	$graph->setYMinAxisType(get_request('ymin_type'		,GRAPH_YAXIS_TYPE_CALCULATED));
 	$graph->setYMaxAxisType(get_request('ymax_type'		,GRAPH_YAXIS_TYPE_CALCULATED));
+	$graph->setYMinAxisType2(get_request('ymin_type2'		,GRAPH_YAXIS_TYPE_CALCULATED));
+	$graph->setYMaxAxisType2(get_request('ymax_type2'		,GRAPH_YAXIS_TYPE_CALCULATED));
 
 	$graph->setYAxisMin(get_request('yaxismin'		,0.00));
 	$graph->setYAxisMax(get_request('yaxismax'		,100.00));
+	$graph->setYAxisMin2(get_request('yaxismin2'		,0.00));
+	$graph->setYAxisMax2(get_request('yaxismax2'		,100.00));
 
 	$graph->setYMinItemId(get_request('ymin_itemid'		,0));
 	$graph->setYMaxItemId(get_request('ymax_itemid'		,0));
+	$graph->setYMinItemId2(get_request('ymin_itemid2'		,0));
+	$graph->setYMaxItemId2(get_request('ymax_itemid2'		,0));
 
 	$graph->setLeftPercentage(get_request('percent_left',0));
 	$graph->setRightPercentage(get_request('percent_right',0));
diff --git a/graphs.php b/graphs.php
index 073bd4d..a6759e6 100644
--- a/graphs.php
+++ b/graphs.php
@@ -50,13 +50,19 @@ include_once('include/page_header.php');
 
 		'ymin_type'=>	array(T_ZBX_INT, O_OPT,	 NULL,	IN('0,1,2'),		null),
 		'ymax_type'=>	array(T_ZBX_INT, O_OPT,	 NULL,	IN('0,1,2'),		null),
+		'ymin_type2'=>	array(T_ZBX_INT, O_OPT,	 NULL,	IN('0,1,2'),		null),
+		'ymax_type2'=>	array(T_ZBX_INT, O_OPT,	 NULL,	IN('0,1,2'),		null),
 		'graphtype'=>	array(T_ZBX_INT, O_OPT,	 NULL,	IN('0,1,2,3'),		'isset({save}) || isset({preview})'),
 		'yaxismin'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	null,	'(isset({save}) || isset({preview}))&&(({graphtype} == 0) || ({graphtype} == 1))'),
 		'yaxismax'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	null,	'(isset({save}) || isset({preview}))&&(({graphtype} == 0) || ({graphtype} == 1))'),
+		'yaxismin2'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	null,	'(isset({save}) || isset({preview}))&&(({graphtype} == 0) || ({graphtype} == 1))'),
+		'yaxismax2'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	null,	'(isset({save}) || isset({preview}))&&(({graphtype} == 0) || ({graphtype} == 1))'),
 		'graph3d'=>		array(T_ZBX_INT, O_OPT,	P_NZERO,	IN('0,1'),		null),
 		'legend'=>		array(T_ZBX_INT, O_OPT,	P_NZERO,	IN('0,1'),		null),
 		'ymin_itemid'=>	array(T_ZBX_INT, O_OPT,	 NULL,	DB_ID,	'(isset({save}) || isset({preview}))&&isset({ymin_type})&&({ymin_type}==3)'),
 		'ymax_itemid'=>	array(T_ZBX_INT, O_OPT,	 NULL,	DB_ID,	'(isset({save}) || isset({preview}))&&isset({ymax_type})&&({ymax_type}==3)'),
+		'ymin_itemid2'=>	array(T_ZBX_INT, O_OPT,	 NULL,	DB_ID,	'(isset({save}) || isset({preview}))&&isset({ymin_type2})&&({ymin_type2}==3)'),
+		'ymax_itemid2'=>	array(T_ZBX_INT, O_OPT,	 NULL,	DB_ID,	'(isset({save}) || isset({preview}))&&isset({ymax_type2})&&({ymax_type2}==3)'),
 		'percent_left'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	BETWEEN(0,100),	null),
 		'percent_right'=>	array(T_ZBX_DBL, O_OPT,	 NULL,	BETWEEN(0,100),	null),
 		'visible'=>			array(T_ZBX_INT, O_OPT,	 NULL,	BETWEEN(0,1),	null),
@@ -158,9 +164,13 @@ include_once('include/page_header.php');
 		else{
 			if(!isset($_REQUEST['ymin_type'])) $_REQUEST['ymin_type'] = 0;
 			if(!isset($_REQUEST['ymax_type'])) $_REQUEST['ymax_type'] = 0;
+			if(!isset($_REQUEST['ymin_type2'])) $_REQUEST['ymin_type2'] = 0;
+			if(!isset($_REQUEST['ymax_type2'])) $_REQUEST['ymax_type2'] = 0;
 
 			if(!isset($_REQUEST['yaxismin'])) $_REQUEST['yaxismin'] = 0;
 			if(!isset($_REQUEST['yaxismax'])) $_REQUEST['yaxismax'] = 0;
+			if(!isset($_REQUEST['yaxismin2'])) $_REQUEST['yaxismin2'] = 0;
+			if(!isset($_REQUEST['yaxismax2'])) $_REQUEST['yaxismax2'] = 0;
 
 			$showworkperiod	= isset($_REQUEST['showworkperiod']) ? 1:0;
 			$showtriggers	= isset($_REQUEST['showtriggers']) ? 1:0;
@@ -180,16 +190,29 @@ include_once('include/page_header.php');
 				$_REQUEST['yaxismax']=0;
 			}
 
+			if($_REQUEST['ymin_itemid2'] != 0 && $_REQUEST['ymax_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+				$_REQUEST['yaxismin2']=0;
+			}
+			if($_REQUEST['ymax_itemid2'] != 0 && $_REQUEST['ymax_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+				$_REQUEST['yaxismax2']=0;
+			}
+
 			$graph = array(
 				'name' => $_REQUEST['name'],
 				'width' => $_REQUEST['width'],
 				'height' => $_REQUEST['height'],
 				'ymin_type' => $_REQUEST['ymin_type'],
 				'ymax_type' => $_REQUEST['ymax_type'],
+				'ymin_type2' => $_REQUEST['ymin_type2'],
+				'ymax_type2' => $_REQUEST['ymax_type2'],
 				'yaxismin' => $_REQUEST['yaxismin'],
 				'yaxismax' => $_REQUEST['yaxismax'],
+				'yaxismin2' => $_REQUEST['yaxismin2'],
+				'yaxismax2' => $_REQUEST['yaxismax2'],
 				'ymin_itemid' => $_REQUEST['ymin_itemid'],
 				'ymax_itemid' => $_REQUEST['ymax_itemid'],
+				'ymin_itemid2' => $_REQUEST['ymin_itemid2'],
+				'ymax_itemid2' => $_REQUEST['ymax_itemid2'],
 				'show_work_period' => get_request('showworkperiod',0),
 				'show_triggers' => get_request('showtriggers',0),
 				'graphtype' => $_REQUEST['graphtype'],
@@ -379,6 +402,8 @@ include_once('include/page_header.php');
 			$table->addRow(new CImg('chart3.php?period=3600'.url_param('name').url_param('width').url_param('height').
 				url_param('ymin_type').url_param('ymax_type').url_param('yaxismin').url_param('yaxismax').
 				url_param('ymin_itemid').url_param('ymax_itemid').
+				url_param('ymin_type2').url_param('ymax_type2').url_param('yaxismin2').url_param('yaxismax2').
+				url_param('ymin_itemid2').url_param('ymax_itemid2').
 				url_param('showworkperiod').url_param('legend').url_param('showtriggers').url_param('graphtype').
 				url_param('percent_left').url_param('percent_right').url_param('items')));
 		}
diff --git a/include/classes/class.cchart.php b/include/classes/class.cchart.php
index c3beaee..8225a25 100644
--- a/include/classes/class.cchart.php
+++ b/include/classes/class.cchart.php
@@ -25,13 +25,18 @@ class CChart extends CGraphDraw{
 	public function __construct($type = GRAPH_TYPE_NORMAL){
 		parent::__construct($type);
 
-		$this->yaxismin = null;
-		$this->yaxismax = null;
+		$this->yaxismin[GRAPH_YAXIS_SIDE_LEFT] = null;
+		$this->yaxismax[GRAPH_YAXIS_SIDE_LEFT] = null;
+		$this->yaxismin[GRAPH_YAXIS_SIDE_RIGHT] = null;
+		$this->yaxismax[GRAPH_YAXIS_SIDE_RIGHT] = null;
 
 		$this->triggers = array();
 
-		$this->ymin_type = GRAPH_YAXIS_TYPE_CALCULATED;
-		$this->ymax_type = GRAPH_YAXIS_TYPE_CALCULATED;
+		$this->ymin_type[GRAPH_YAXIS_SIDE_LEFT] = GRAPH_YAXIS_TYPE_CALCULATED;
+		$this->ymax_type[GRAPH_YAXIS_SIDE_LEFT] = GRAPH_YAXIS_TYPE_CALCULATED;
+		$this->ymin_type[GRAPH_YAXIS_SIDE_RIGHT] = GRAPH_YAXIS_TYPE_CALCULATED;
+		$this->ymax_type[GRAPH_YAXIS_SIDE_RIGHT] = GRAPH_YAXIS_TYPE_CALCULATED;
+
 
 		$this->yaxisright=0;
 		$this->yaxisleft=0;
@@ -39,8 +44,10 @@ class CChart extends CGraphDraw{
 		$this->skipLeftScale = 0;		// in case if left axis should be drawn but doesn't contain any data
 		$this->skipRightScale = 0;		// in case if right axis should be drawn but doesn't contain any data
 
-		$this->ymin_itemid = 0;
-		$this->ymax_itemid = 0;
+		$this->ymin_itemid[GRAPH_YAXIS_SIDE_LEFT] = 0;
+		$this->ymax_itemid[GRAPH_YAXIS_SIDE_LEFT] = 0;
+		$this->ymin_itemid[GRAPH_YAXIS_SIDE_RIGHT] = 0;
+		$this->ymax_itemid[GRAPH_YAXIS_SIDE_RIGHT] = 0;
 
 		$this->legendOffsetY = 90;
 
@@ -159,27 +166,51 @@ class CChart extends CGraphDraw{
 	}
 
 	public function setYMinAxisType($yaxistype){
-		$this->ymin_type=$yaxistype;
+		$this->ymin_type[GRAPH_YAXIS_SIDE_LEFT]=$yaxistype;
 	}
 
 	public function setYMaxAxisType($yaxistype){
-		$this->ymax_type=$yaxistype;
+		$this->ymax_type[GRAPH_YAXIS_SIDE_LEFT]=$yaxistype;
 	}
 
 	public function setYAxisMin($yaxismin){
-		$this->yaxismin=$yaxismin;
+		$this->yaxismin[GRAPH_YAXIS_SIDE_LEFT]=$yaxismin;
 	}
 
 	public function setYAxisMax($yaxismax){
-		$this->yaxismax=$yaxismax;
+		$this->yaxismax[GRAPH_YAXIS_SIDE_LEFT]=$yaxismax;
 	}
 
 	public function setYMinItemId($itemid){
-		$this->ymin_itemid=$itemid;
+		$this->ymin_itemid[GRAPH_YAXIS_SIDE_LEFT]=$itemid;
 	}
 
 	public function setYMaxItemId($itemid){
-		$this->ymax_itemid=$itemid;
+		$this->ymax_itemid[GRAPH_YAXIS_SIDE_LEFT]=$itemid;
+	}
+
+	public function setYMinAxisType2($yaxistype){
+		$this->ymin_type[GRAPH_YAXIS_SIDE_RIGHT]=$yaxistype;
+	}
+
+	public function setYMaxAxisType2($yaxistype){
+		$this->ymax_type[GRAPH_YAXIS_SIDE_RIGHT]=$yaxistype;
+	}
+
+	public function setYAxisMin2($yaxismin){
+		$this->yaxismin[GRAPH_YAXIS_SIDE_RIGHT]=$yaxismin;
+	}
+
+	public function setYAxisMax2($yaxismax){
+		$this->yaxismax[GRAPH_YAXIS_SIDE_RIGHT]=$yaxismax;
+	}
+
+	public function setYMinItemId2($itemid){
+		$this->ymin_itemid[GRAPH_YAXIS_SIDE_RIGHT]=$itemid;
+	}
+
+	public function setYMaxItemId2($itemid){
+		$this->ymax_itemid[GRAPH_YAXIS_SIDE_RIGHT]=$itemid;
 	}
 
 	public function setLeftPercentage($percentile){
@@ -554,11 +585,11 @@ class CChart extends CGraphDraw{
 
 // Calculation of minimum Y axis
 	protected function calculateMinY($side){
-		if($this->ymin_type == GRAPH_YAXIS_TYPE_FIXED){
-			return $this->yaxismin;
+		if($this->ymin_type[$side] == GRAPH_YAXIS_TYPE_FIXED){
+			return $this->yaxismin[$side];
 		}
-		else if($this->ymin_type == GRAPH_YAXIS_TYPE_ITEM_VALUE){
-			$item = get_item_by_itemid($this->ymin_itemid);
+		else if($this->ymin_type[$side] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+			$item = get_item_by_itemid($this->ymin_itemid[$side]);
 			if($item && isset($item['lastvalue']) && !is_null($item['lastvalue']))
 				return $item['lastvalue'];
 		}
@@ -625,11 +656,11 @@ class CChart extends CGraphDraw{
 
 // Calculation of maximum Y of a side (left/right)
 	protected function calculateMaxY($side){
-		if($this->ymax_type==GRAPH_YAXIS_TYPE_FIXED){
-			return $this->yaxismax;
+		if($this->ymax_type[$side]==GRAPH_YAXIS_TYPE_FIXED){
+			return $this->yaxismax[$side];
 		}
-		else if($this->ymax_type==GRAPH_YAXIS_TYPE_ITEM_VALUE){
-			$item = get_item_by_itemid($this->ymax_itemid);
+		else if($this->ymax_type[$side]==GRAPH_YAXIS_TYPE_ITEM_VALUE){
+			$item = get_item_by_itemid($this->ymax_itemid[$side]);
 			if($item && isset($item['lastvalue']) && !is_null($item['lastvalue'])){
 				 return $item['lastvalue'];
 			}
@@ -735,15 +766,16 @@ class CChart extends CGraphDraw{
 				continue;
 			}
 
-			if($this->ymax_type == GRAPH_YAXIS_TYPE_FIXED){
-				$this->m_maxY[$side] = $this->yaxismax;
+			if($this->ymax_type[$side] == GRAPH_YAXIS_TYPE_FIXED){
+				$this->m_maxY[$side] = $this->yaxismax[$side];
 				$this->m_minY[$side] = 0;
 			}
+			
 
-			if($this->ymin_type == GRAPH_YAXIS_TYPE_FIXED){
-				$this->m_minY[$side] = $this->yaxismin;
+			if($this->ymin_type[$side] == GRAPH_YAXIS_TYPE_FIXED){
+				$this->m_minY[$side] = $this->yaxismin[$side];
 
-				if(($this->ymax_type == GRAPH_YAXIS_TYPE_CALCULATED) && bccomp($this->m_maxY[$side], $this->m_minY[$side]) == -1){
+				if(($this->ymax_type[$side] == GRAPH_YAXIS_TYPE_CALCULATED) && bccomp($this->m_maxY[$side], $this->m_minY[$side]) == -1){
 					$this->m_maxY[$side] = bcmul($this->m_minY[$side], 1.2);
 				}
 			}
@@ -875,18 +907,20 @@ class CChart extends CGraphDraw{
 				$this->m_minY[$graphSide] = bccomp($tmp_minY[GRAPH_YAXIS_SIDE_LEFT], 0) == -1 ? $tmp_minY[GRAPH_YAXIS_SIDE_LEFT] : 0;
 			}
 
-			if($this->ymax_type == GRAPH_YAXIS_TYPE_FIXED){
-				$this->m_maxY[$graphSide] = $this->yaxismax;
+
+			if($this->ymax_type[$graphSide] == GRAPH_YAXIS_TYPE_FIXED){
+				$this->m_maxY[$graphSide] = $this->yaxismax[$graphSide];
 				$this->m_minY[$graphSide] = 0;
 			}
-			else if($this->ymax_type == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+			else if($this->ymax_type[$graphSide] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
 				$this->m_maxY[$graphSide] = $tmp_maxY[$graphSide];
 			}
 
-			if($this->ymin_type == GRAPH_YAXIS_TYPE_FIXED){
-				$this->m_minY[$graphSide] = $this->yaxismin;
+			
+			if($this->ymin_type[$graphSide] == GRAPH_YAXIS_TYPE_FIXED){
+				$this->m_minY[$graphSide] = $this->yaxismin[$graphSide];
 			}
-			else if($this->ymin_type == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+			else if($this->ymin_type[$graphSide] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
 				$this->m_minY[$graphSide] = $tmp_minY[$graphSide];
 			}
 		}
@@ -2022,40 +2056,26 @@ class CChart extends CGraphDraw{
 
 		$this->selectData();
 
-		$this->m_minY[GRAPH_YAXIS_SIDE_LEFT]	= $this->calculateMinY(GRAPH_YAXIS_SIDE_LEFT);
-		$this->m_minY[GRAPH_YAXIS_SIDE_RIGHT]	= $this->calculateMinY(GRAPH_YAXIS_SIDE_RIGHT);
-		$this->m_maxY[GRAPH_YAXIS_SIDE_LEFT]	= $this->calculateMaxY(GRAPH_YAXIS_SIDE_LEFT);
-		$this->m_maxY[GRAPH_YAXIS_SIDE_RIGHT]	= $this->calculateMaxY(GRAPH_YAXIS_SIDE_RIGHT);
-//*
-		if($this->m_minY[GRAPH_YAXIS_SIDE_LEFT] == $this->m_maxY[GRAPH_YAXIS_SIDE_LEFT]){
-			if($this->graphOrientation[GRAPH_YAXIS_SIDE_LEFT] == '-') $this->m_maxY[GRAPH_YAXIS_SIDE_LEFT] = 0;
-			else if($this->m_minY[GRAPH_YAXIS_SIDE_LEFT] == 0){
-				$this->m_maxY[GRAPH_YAXIS_SIDE_LEFT] = 1;
-			}
-			else $this->m_minY[GRAPH_YAXIS_SIDE_LEFT] = 0;
-		}
-		else if($this->m_minY[GRAPH_YAXIS_SIDE_LEFT] > $this->m_maxY[GRAPH_YAXIS_SIDE_LEFT]){
-			if($this->graphOrientation[GRAPH_YAXIS_SIDE_LEFT] == '-'){
-				$this->m_minY[GRAPH_YAXIS_SIDE_LEFT] = 0.2 * $this->m_maxY[GRAPH_YAXIS_SIDE_LEFT];
-			}
-			else $this->m_minY[GRAPH_YAXIS_SIDE_LEFT] = 0;
-		}
-
-		if($this->m_minY[GRAPH_YAXIS_SIDE_RIGHT] == $this->m_maxY[GRAPH_YAXIS_SIDE_RIGHT]){
-			if($this->graphOrientation[GRAPH_YAXIS_SIDE_RIGHT] == '-') $this->m_maxY[GRAPH_YAXIS_SIDE_RIGHT] = 0;
-			else if($this->m_minY[GRAPH_YAXIS_SIDE_RIGHT] == 0){
-				$this->m_maxY[GRAPH_YAXIS_SIDE_RIGHT] = 1;
-//				$this->skipRightScale = 1;
+		$sides = array(GRAPH_YAXIS_SIDE_LEFT, GRAPH_YAXIS_SIDE_RIGHT);
+		
+		foreach ($sides as $snum => $side) {
+			$this->m_minY[$side]	= $this->calculateMinY($side);
+			$this->m_maxY[$side]	= $this->calculateMaxY($side);
+
+			if($this->m_minY[$side] == $this->m_maxY[$side]){
+				if($this->graphOrientation[$side] == '-') $this->m_maxY[$side] = 0;
+				else if($this->m_minY[$side] == 0){
+					$this->m_maxY[$side] = 1;
+				}
+				else $this->m_minY[$side] = 0;
 			}
-			else $this->m_minY[GRAPH_YAXIS_SIDE_RIGHT] = 0;
-		}
-		else if($this->m_minY[GRAPH_YAXIS_SIDE_RIGHT] > $this->m_maxY[GRAPH_YAXIS_SIDE_RIGHT]){
-			if($this->graphOrientation[GRAPH_YAXIS_SIDE_RIGHT] == '-'){
-				$this->m_minY[GRAPH_YAXIS_SIDE_RIGHT] = 0.2 * $this->m_maxY[GRAPH_YAXIS_SIDE_RIGHT];
+			else if($this->m_minY[$side] > $this->m_maxY[$side]){
+				if($this->graphOrientation[$side] == '-'){
+					$this->m_minY[$side] = 0.2 * $this->m_maxY[$side];
+				}
+				else $this->m_minY[$side] = 0;
 			}
-			else $this->m_minY[GRAPH_YAXIS_SIDE_RIGHT] = 0;
 		}
-//*/
 		$this->calcMinMaxInterval();
 
 		$this->updateShifts();
diff --git a/include/export.inc.php b/include/export.inc.php
index 0f0df5b..073cb65 100644
--- a/include/export.inc.php
+++ b/include/export.inc.php
@@ -195,13 +195,19 @@ class zbxXML{
 			'elements' => array(
 				'ymin_type'			=> '',
 				'ymax_type'			=> '',
+				'ymin_type2'		=> '',
+				'ymax_type2'		=> '',
 				'ymin_item_key'		=> '',
 				'ymax_item_key'		=> '',
+				'ymin_item_key2'	=> '',
+				'ymax_item_key2'	=> '',
 				'show_work_period'	=> '',
 				'show_triggers'		=> '',
 				'graphtype'			=> '',
 				'yaxismin'			=> '',
 				'yaxismax'			=> '',
+				'yaxismin2'			=> '',
+				'yaxismax2'			=> '',
 				'show_legend'		=> '',
 				'show_3d'			=> '',
 				'percent_left'		=> '',
@@ -1362,6 +1368,19 @@ class zbxXML{
 								$graph_db['ymin_itemid'] = $item['itemid'];
 							}
 
+							if($graph_db['ymin_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+								$item_data = explode(':', $graph_db['ymin_item_key2'], 2);
+								if(count($item_data) < 2){
+									throw new APIException(1, 'Incorrect y min item (right side) for graph ['.$graph_db['name'].']');
+								}
+
+								if(!$item = get_item_by_key($item_data[1], $item_data[0])){
+									throw new APIException(1, 'Missing item ['.$graph_db['ymin_item_key2'].'] for host ['.$host_db['host'].']');
+								}
+
+								$graph_db['ymin_itemid2'] = $item['itemid'];
+							}
+
 							if($graph_db['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
 								$item_data = explode(':', $graph_db['ymax_item_key'], 2);
 								if(count($item_data) < 2){
@@ -1375,6 +1394,19 @@ class zbxXML{
 								$graph_db['ymax_itemid'] = $item['itemid'];
 							}
 
+							if($graph_db['ymax_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+								$item_data = explode(':', $graph_db['ymax_item_key2'], 2);
+								if(count($item_data) < 2){
+									throw new APIException(1, 'Incorrect y max item (right side) for graph ['.$graph_db['name'].']');
+								}
+
+								if(!$item = get_item_by_key($item_data[1], $item_data[0])){
+									throw new APIException(1, 'Missing item ['.$graph_db['ymax_item_key2'].'] for host ['.$host_db['host'].']');
+								}
+
+								$graph_db['ymax_itemid2'] = $item['itemid'];
+							}
+
 
 							$graph_db['gitems'] = $graph_items;
 							if($current_graph){
@@ -1521,6 +1553,10 @@ class zbxXML{
 						$itemminmaxids[$graph['ymin_itemid']] = $graph['ymin_itemid'];
 					if($graph['ymax_itemid'] && ($graph['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE))
 						$itemminmaxids[$graph['ymax_itemid']] = $graph['ymax_itemid'];
+					if($graph['ymin_itemid2'] && ($graph['ymin_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE))
+						$itemminmaxids[$graph['ymin_itemid2']] = $graph['ymin_itemid2'];
+					if($graph['ymax_itemid2'] && ($graph['ymax_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE))
+						$itemminmaxids[$graph['ymax_itemid2']] = $graph['ymax_itemid2'];
 				}
 
 				$options = array(
@@ -1549,6 +1585,14 @@ class zbxXML{
 						else{
 							$graph['ymin_item_key'] = '';
 						}
+						
+						if($graph['ymin_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+							$graph['ymin_item_key2'] = $hostminmaxs[$itemminmaxs[$graph['ymin_itemid2']]['hostid']]['host'].':'.
+									$itemminmaxs[$graph['ymin_itemid2']]['key_'];
+						}
+						else{
+							$graph['ymin_item_key2'] = '';
+						}
 
 						if($graph['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
 							$graph['ymax_item_key'] = $hostminmaxs[$itemminmaxs[$graph['ymax_itemid']]['hostid']]['host'].':'.
@@ -1558,6 +1602,14 @@ class zbxXML{
 							$graph['ymax_item_key'] = '';
 						}
 
+						if($graph['ymax_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+							$graph['ymax_item_key2'] = $hostminmaxs[$itemminmaxs[$graph['ymax_itemid2']]['hostid']]['host'].':'.
+									$itemminmaxs[$graph['ymax_itemid2']]['key_'];
+						}
+						else{
+							$graph['ymax_item_key2'] = '';
+						}
+
 						$graph_node = self::addChildData($graphs_node, XML_TAG_GRAPH, $graph);
 
 						if(isset($data['graphs_items'])){
diff --git a/include/forms.inc.php b/include/forms.inc.php
index 89829c9..86ff959 100644
--- a/include/forms.inc.php
+++ b/include/forms.inc.php
@@ -2931,10 +2931,16 @@ ITEM_TYPE_CALCULATED $key = ''; $params = '';
 			$height = $row['height'];
 			$ymin_type = $row['ymin_type'];
 			$ymax_type = $row['ymax_type'];
+			$ymin_type2 = $row['ymin_type2'];
+			$ymax_type2 = $row['ymax_type2'];
 			$yaxismin = $row['yaxismin'];
 			$yaxismax = $row['yaxismax'];
+			$yaxismin2 = $row['yaxismin2'];
+			$yaxismax2 = $row['yaxismax2'];
 			$ymin_itemid = $row['ymin_itemid'];
 			$ymax_itemid = $row['ymax_itemid'];
+			$ymin_itemid2 = $row['ymin_itemid2'];
+			$ymax_itemid2 = $row['ymax_itemid2'];
 			$showworkperiod = $row['show_work_period'];
 			$showtriggers = $row['show_triggers'];
 			$graphtype = $row['graphtype'];
@@ -2966,10 +2972,16 @@ ITEM_TYPE_CALCULATED $key = ''; $params = '';
 			}
 			$ymin_type = get_request('ymin_type', GRAPH_YAXIS_TYPE_CALCULATED);
 			$ymax_type = get_request('ymax_type', GRAPH_YAXIS_TYPE_CALCULATED);
+			$ymin_type2 = get_request('ymin_type2', GRAPH_YAXIS_TYPE_CALCULATED);
+			$ymax_type2 = get_request('ymax_type2', GRAPH_YAXIS_TYPE_CALCULATED);
 			$yaxismin = get_request('yaxismin', 0.00);
 			$yaxismax = get_request('yaxismax', 100.00);
+			$yaxismin2 = get_request('yaxismin2', 0.00);
+			$yaxismax2 = get_request('yaxismax2', 100.00);
 			$ymin_itemid = get_request('ymin_itemid', 0);
 			$ymax_itemid	= get_request('ymax_itemid', 0);
+			$ymin_itemid2 = get_request('ymin_itemid2', 0);
+			$ymax_itemid2	= get_request('ymax_itemid2', 0);
 			$showworkperiod = get_request('showworkperiod', 0);
 			$showtriggers	= get_request('showtriggers', 0);
 			$legend = get_request('legend' ,0);
@@ -2990,12 +3002,18 @@ ITEM_TYPE_CALCULATED $key = ''; $params = '';
 
 		$_REQUEST['ymin_type']		= $ymin_type;
 		$_REQUEST['ymax_type']		= $ymax_type;
+		$_REQUEST['ymin_type2']		= $ymin_type2;
+		$_REQUEST['ymax_type2']		= $ymax_type2;
 
 		$_REQUEST['yaxismin']		= $yaxismin;
 		$_REQUEST['yaxismax']		= $yaxismax;
+		$_REQUEST['yaxismin2']		= $yaxismin2;
+		$_REQUEST['yaxismax2']		= $yaxismax2;
 
 		$_REQUEST['ymin_itemid']	= $ymin_itemid;
 		$_REQUEST['ymax_itemid']	= $ymax_itemid;
+		$_REQUEST['ymin_itemid2']	= $ymin_itemid2;
+		$_REQUEST['ymax_itemid2']	= $ymax_itemid2;
 
 		$_REQUEST['showworkperiod']	= $showworkperiod;
 		$_REQUEST['showtriggers']	= $showtriggers;
@@ -3035,6 +3053,8 @@ ITEM_TYPE_CALCULATED $key = ''; $params = '';
 
 		$frmGraph->addVar('ymin_itemid', $ymin_itemid);
 		$frmGraph->addVar('ymax_itemid', $ymax_itemid);
+		$frmGraph->addVar('ymin_itemid2', $ymin_itemid2);
+		$frmGraph->addVar('ymax_itemid2', $ymax_itemid2);
 
 		$frmGraph->addRow(S_NAME, new CTextBox('name', $name, 32));
 
@@ -3169,13 +3189,20 @@ ITEM_TYPE_CALCULATED $key = ''; $params = '';
 			}
 
 			$yaxis_min = array();
+			$yaxis_min2 = array();
 
 			$cmbYType = new CComboBox('ymin_type',$ymin_type,'javascript: submit();');
 			$cmbYType->addItem(GRAPH_YAXIS_TYPE_CALCULATED,S_CALCULATED);
 			$cmbYType->addItem(GRAPH_YAXIS_TYPE_FIXED,S_FIXED);
 			$cmbYType->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE,S_ITEM);
 
+			$cmbYType2 = new CComboBox('ymin_type2',$ymin_type2,'javascript: submit();');
+			$cmbYType2->addItem(GRAPH_YAXIS_TYPE_CALCULATED,S_CALCULATED);
+			$cmbYType2->addItem(GRAPH_YAXIS_TYPE_FIXED,S_FIXED);
+			$cmbYType2->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE,S_ITEM);
+
 			$yaxis_min[] = $cmbYType;
+			$yaxis_min2[] = $cmbYType2;
 
 			if($ymin_type == GRAPH_YAXIS_TYPE_FIXED){
 				$yaxis_min[] = new CTextBox("yaxismin",$yaxismin,9);
@@ -3210,16 +3237,55 @@ ITEM_TYPE_CALCULATED $key = ''; $params = '';
 				$frmGraph->addVar('yaxismin', $yaxismin);
 			}
 
-			$frmGraph->addRow(S_YAXIS_MIN_VALUE, $yaxis_min);
+			if($ymin_type2 == GRAPH_YAXIS_TYPE_FIXED){
+				$yaxis_min2[] = new CTextBox("yaxismin2",$yaxismin2,9);
+			}
+			else if($ymin_type2 == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+				$frmGraph->addVar('yaxismin2',$yaxismin2);
+
+				$ymin_name2 = '';
+				if($ymin_itemid2 > 0){
+					$min_host = get_host_by_itemid($ymin_itemid2);
+					$min_item = get_item_by_itemid($ymin_itemid2);
+					$ymin_name2 = $min_host['host'].':'.item_description($min_item);
+				}
+
+				if(count($items)){
+					$yaxis_min2[] = new CTextBox("ymin_name2",$ymin_name2,80,'yes');
+					$yaxis_min2[] = new CButton('yaxis_min2',S_SELECT,'javascript: '.
+													"return PopUp('popup.php?dstfrm=".$frmGraph->getName().
+													url_param($only_hostid, false, 'only_hostid').
+													url_param($monitored_hosts, false, 'monitored_hosts').
+														"&dstfld1=ymin_itemid2".
+														"&dstfld2=ymin_name2".
+														"&srctbl=items".
+														"&srcfld1=itemid".
+														"&srcfld2=description',0,0,'zbx_popup_item');");
+				}
+				else{
+					$yaxis_min2[] = SPACE.S_ADD_GRAPH_ITEMS;
+				}
+			}
+			else{
+				$frmGraph->addVar('yaxismin2', $yaxismin2);
+			}
+
+			$frmGraph->addRow(S_YAXIS_MIN_VALUE.' ('.S_LEFT.')', $yaxis_min);
 
 			$yaxis_max = array();
+			$yaxis_max2 = array();
 
 			$cmbYType = new CComboBox("ymax_type",$ymax_type,"submit()");
 			$cmbYType->addItem(GRAPH_YAXIS_TYPE_CALCULATED,S_CALCULATED);
 			$cmbYType->addItem(GRAPH_YAXIS_TYPE_FIXED,S_FIXED);
 			$cmbYType->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE,S_ITEM);
+			$cmbYType2 = new CComboBox("ymax_type2",$ymax_type2,"submit()");
+			$cmbYType2->addItem(GRAPH_YAXIS_TYPE_CALCULATED,S_CALCULATED);
+			$cmbYType2->addItem(GRAPH_YAXIS_TYPE_FIXED,S_FIXED);
+			$cmbYType2->addItem(GRAPH_YAXIS_TYPE_ITEM_VALUE,S_ITEM);
 
 			$yaxis_max[] = $cmbYType;
+			$yaxis_max2[] = $cmbYType2;
 
 			if($ymax_type == GRAPH_YAXIS_TYPE_FIXED){
 				$yaxis_max[] = new CTextBox('yaxismax',$yaxismax,9);
@@ -3253,8 +3319,43 @@ ITEM_TYPE_CALCULATED $key = ''; $params = '';
 			else{
 				$frmGraph->addVar('yaxismax',$yaxismax);
 			}
+			if($ymax_type2 == GRAPH_YAXIS_TYPE_FIXED){
+				$yaxis_max2[] = new CTextBox('yaxismax2',$yaxismax2,9);
+			}
+			else if($ymax_type2 == GRAPH_YAXIS_TYPE_ITEM_VALUE){
+				$frmGraph->addVar('yaxismax2',$yaxismax2);
+
+				$ymax_name2 = '';
+				if($ymax_itemid2 > 0){
+					$max_host = get_host_by_itemid($ymax_itemid2);
+					$max_item = get_item_by_itemid($ymax_itemid2);
+					$ymax_name2 = $max_host['host'].':'.item_description($max_item);
+				}
+
+				if(count($items)){
+					$yaxis_max2[] = new CTextBox("ymax_name2",$ymax_name2,80,'yes');
+					$yaxis_max2[] = new CButton('yaxis_max2',S_SELECT,'javascript: '.
+													"return PopUp('popup.php?dstfrm=".$frmGraph->getName().
+													url_param($only_hostid, false, 'only_hostid').
+													url_param($monitored_hosts, false, 'monitored_hosts').
+														"&dstfld1=ymax_itemid2".
+														"&dstfld2=ymax_name2".
+														"&srctbl=items".
+														"&srcfld1=itemid".
+														"&srcfld2=description',0,0,'zbx_popup_item');");
+				}
+				else{
+					$yaxis_max2[] = SPACE.S_ADD_GRAPH_ITEMS;
+				}
+			}
+			else{
+				$frmGraph->addVar('yaxismax2',$yaxismax2);
+			}
+
+			$frmGraph->addRow(S_YAXIS_MAX_VALUE.' ('.S_LEFT.')', $yaxis_max);
 
-			$frmGraph->addRow(S_YAXIS_MAX_VALUE, $yaxis_max);
+			$frmGraph->addRow(S_YAXIS_MIN_VALUE.' ('.S_RIGHT.')', $yaxis_min2);
+			$frmGraph->addRow(S_YAXIS_MAX_VALUE.' ('.S_RIGHT.')', $yaxis_max2);
 		}
 		else{
 			$frmGraph->addRow(S_SHOW_LEGEND, new CCheckBox('legend',$legend, null, 1));
diff --git a/include/graphs.inc.php b/include/graphs.inc.php
index 8178df0..4272d6f 100644
--- a/include/graphs.inc.php
+++ b/include/graphs.inc.php
@@ -379,13 +379,13 @@
          * Comments: !!! Don't forget sync code with C !!!
          *
          */
-	function add_graph($name,$width,$height,$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$templateid=0)
+	function add_graph($name,$width,$height,$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$templateid=0)
 	{
 		$graphid = get_dbid("graphs","graphid");
 
 		$result=DBexecute('INSERT INTO graphs '.
-			' (graphid,name,width,height,ymin_type,ymax_type,yaxismin,yaxismax,ymin_itemid,ymax_itemid,templateid,show_work_period,show_triggers,graphtype,show_legend,show_3d,percent_left,percent_right) '.
-			" VALUES ($graphid,".zbx_dbstr($name).",$width,$height,$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,".
+			' (graphid,name,width,height,ymin_type,ymax_type,ymin_type2,ymax_type2,yaxismin,yaxismax,yaxismin2,yaxismax2,ymin_itemid,ymax_itemid,ymin_itemid2,ymax_itemid2,templateid,show_work_period,show_triggers,graphtype,show_legend,show_3d,percent_left,percent_right) '.
+			" VALUES ($graphid,".zbx_dbstr($name).",$width,$height,$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,".
 			" $templateid,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right)");
 
 		return ( $result ? $graphid : $result);
@@ -403,7 +403,7 @@
          * Comments: !!! Don't forget sync code with C !!!
          *
          */
-	function add_graph_with_items($name,$width,$height,$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$gitems=array(),$templateid=0)
+	function add_graph_with_items($name,$width,$height,$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$gitems=array(),$templateid=0)
 	{
 		$result = false;
 
@@ -448,7 +448,7 @@
 			// return false;
 		// }
 
-		if($graphid = add_graph($name,$width,$height,$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$templateid)){
+		if($graphid = add_graph($name,$width,$height,$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$templateid)){
 			$result = true;
 			foreach($gitems as $gitem){
 				if (!$result = add_item_to_graph(
@@ -500,7 +500,7 @@
          * Comments: !!! Don't forget sync code with C !!!
          *
          */
-	function update_graph($graphid,$name,$width,$height,$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$templateid=0){
+	function update_graph($graphid,$name,$width,$height,$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$templateid=0){
 
 		$g_graph = get_graph_by_graphid($graphid);
 
@@ -510,10 +510,16 @@
 				'height='.$height.','.
 				'ymin_type='.$ymin_type.','.
 				'ymax_type='.$ymax_type.','.
+				'ymin_type2='.$ymin_type2.','.
+				'ymax_type2='.$ymax_type2.','.
 				'yaxismin='.$yaxismin.','.
 				'yaxismax='.$yaxismax.','.
+				'yaxismin2='.$yaxismin2.','.
+				'yaxismax2='.$yaxismax2.','.
 				'ymin_itemid='.$ymin_itemid.','.
 				'ymax_itemid='.$ymax_itemid.','.
+				'ymin_itemid2='.$ymin_itemid2.','.
+				'ymax_itemid2='.$ymax_itemid2.','.
 				'templateid='.$templateid.','.
 				'show_work_period='.$showworkperiod.','.
 				'show_triggers='.$showtriggers.','.
@@ -545,7 +551,7 @@
  * Comments: !!! Don't forget sync code with C !!!
  *
  */
-	function update_graph_with_items($graphid,$name,$width,$height,$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$gitems=array(),$templateid=0)
+	function update_graph_with_items($graphid,$name,$width,$height,$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,$showworkperiod,$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$gitems=array(),$templateid=0)
 	{
 		$result = false;
 
@@ -592,7 +598,7 @@
 			}
 
 			if (!$result = update_graph_with_items($chd_graph['graphid'], $name, $width, $height,
-				$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,
+				$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,
 				$showworkperiod, $showtriggers, $graphtype, $legend, $graph3d, $percent_left, $percent_right, $new_gitems, $graphid))
 			{
 				return $result;
@@ -617,7 +623,7 @@
 			}
 		}
 
-		if ($result = update_graph($graphid,$name,$width,$height,$ymin_type,$ymax_type,$yaxismin,$yaxismax,$ymin_itemid,$ymax_itemid,$showworkperiod,
+		if ($result = update_graph($graphid,$name,$width,$height,$ymin_type,$ymax_type,$ymin_type2,$ymax_type2,$yaxismin,$yaxismax,$yaxismin2,$yaxismax2,$ymin_itemid,$ymax_itemid,$ymin_itemid2,$ymax_itemid2,$showworkperiod,
 						$showtriggers,$graphtype,$legend,$graph3d,$percent_left,$percent_right,$templateid))
 		{
 			$host_list = array();
@@ -891,6 +897,17 @@
 				$db_graph['ymin_itemid'] = $itemid;
 			}
 		}
+		if ($db_graph['ymax_itemid2']) {
+			if ($itemid = get_same_item_for_host($db_graph['ymax_itemid2'], $hostid)) {
+				$db_graph['ymax_itemid2'] = $itemid;
+			};
+		}
+
+		if ($db_graph['ymin_itemid2']) {
+			if ($itemid = get_same_item_for_host($db_graph['ymin_itemid2'], $hostid)) {
+				$db_graph['ymin_itemid2'] = $itemid;
+			}
+		}
 
 		if($new_gitems = get_same_graphitems_for_host($gitems, $hostid)){
 
@@ -931,15 +948,15 @@
 
 			if(isset($chd_graphid)){
 				$result = update_graph_with_items($chd_graphid, $db_graph['name'], $db_graph['width'], $db_graph['height'],
-					$db_graph['ymin_type'], $db_graph['ymax_type'], $db_graph['yaxismin'], $db_graph['yaxismax'],
-					$db_graph['ymin_itemid'], $db_graph['ymax_itemid'],
+					$db_graph['ymin_type'], $db_graph['ymax_type'], $db_graph['ymin_type2'], $db_graph['ymax_type2'], $db_graph['yaxismin'], $db_graph['yaxismax'], $db_graph['yaxismin2'], $db_graph['yaxismax2'],
+					$db_graph['ymin_itemid'], $db_graph['ymax_itemid'], $db_graph['ymin_itemid2'], $db_graph['ymax_itemid2'],
 					$db_graph['show_work_period'], $db_graph['show_triggers'], $db_graph['graphtype'],$db_graph['show_legend'],
 					$db_graph['show_3d'], $db_graph['percent_left'], $db_graph['percent_right'], $new_gitems, ($copy_mode ? 0: $db_graph['graphid']));
 			}
 			else{
 				$result = add_graph_with_items($db_graph['name'], $db_graph['width'], $db_graph['height'],
-					$db_graph['ymin_type'], $db_graph['ymax_type'], $db_graph['yaxismin'], $db_graph['yaxismax'],
-					$db_graph['ymin_itemid'], $db_graph['ymax_itemid'],
+					$db_graph['ymin_type'], $db_graph['ymax_type'], $db_graph['ymin_type2'], $db_graph['ymax_type2'], $db_graph['yaxismin'], $db_graph['yaxismax'], $db_graph['yaxismin2'], $db_graph['yaxismax2'],
+					$db_graph['ymin_itemid'], $db_graph['ymax_itemid'], $db_graph['ymin_itemid2'], $db_graph['ymax_itemid2'],
 					$db_graph['show_work_period'], $db_graph['show_triggers'], $db_graph['graphtype'],$db_graph['show_legend'],
 					$db_graph['show_3d'], $db_graph['percent_left'], $db_graph['percent_right'], $new_gitems, ($copy_mode ? 0: $db_graph['graphid']));
 			}
diff --git a/include/schema.inc.php b/include/schema.inc.php
index b289285..0890c58 100644
--- a/include/schema.inc.php
+++ b/include/schema.inc.php
@@ -2086,6 +2086,42 @@ return array(
 				'length' => 20,
 				'default' => '0',
 			),
+			'yaxismin2' => array(
+				'null' => false,
+				'type' => DB::FIELD_TYPE_FLOAT,
+				'length' => 16,
+				'default' => '0',
+			),
+			'yaxismax2' => array(
+				'null' => false,
+				'type' => DB::FIELD_TYPE_FLOAT,
+				'length' => 16,
+				'default' => '0',
+			),
+			'ymin_type2' => array(
+				'null' => false,
+				'type' => DB::FIELD_TYPE_INT,
+				'length' => 10,
+				'default' => '0',
+			),
+			'ymax_type2' => array(
+				'null' => false,
+				'type' => DB::FIELD_TYPE_INT,
+				'length' => 10,
+				'default' => '0',
+			),
+			'ymin_itemid2' => array(
+				'null' => false,
+				'type' => DB::FIELD_TYPE_ID,
+				'length' => 20,
+				'default' => '0',
+			),
+			'ymax_itemid2' => array(
+				'null' => false,
+				'type' => DB::FIELD_TYPE_ID,
+				'length' => 20,
+				'default' => '0',
+			),
 		),
 	),
 	'graphs_items' => array(
diff --git a/include/screens.inc.php b/include/screens.inc.php
index 6f9524a..9932fa7 100644
--- a/include/screens.inc.php
+++ b/include/screens.inc.php
@@ -942,6 +942,20 @@ require_once('include/js.inc.php');
 									$graph['ymax_type'] = GRAPH_YAXIS_TYPE_CALCULATED;
 								}
 							}
+							if($graph['ymax_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymax_itemid2']){
+								$new_dinamic = get_same_graphitems_for_host(
+									array(array('itemid' => $graph['ymax_itemid2'])),
+									$_REQUEST['hostid'],
+									false // false = don't rise Error if item doesn't exist
+								);
+								$new_dinamic = reset($new_dinamic);
+								if(isset($new_dinamic['itemid']) && $new_dinamic['itemid'] > 0){
+									$graph['ymax_itemid2'] = $new_dinamic['itemid'];
+								}
+								else{
+									$graph['ymax_type2'] = GRAPH_YAXIS_TYPE_CALCULATED;
+								}
+							}
 							if($graph['ymin_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymin_itemid']){
 								$new_dinamic = get_same_graphitems_for_host(
 									array(array('itemid' => $graph['ymin_itemid'])),
@@ -956,6 +970,20 @@ require_once('include/js.inc.php');
 									$graph['ymin_type'] = GRAPH_YAXIS_TYPE_CALCULATED;
 								}
 							}
+							if($graph['ymin_type2'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymin_itemid2']){
+								$new_dinamic = get_same_graphitems_for_host(
+									array(array('itemid' => $graph['ymin_itemid2'])),
+									$_REQUEST['hostid'],
+									false // false = don't rise Error if item doesn't exist
+								);
+								$new_dinamic = reset($new_dinamic);
+								if(isset($new_dinamic['itemid']) && $new_dinamic['itemid'] > 0){
+									$graph['ymin_itemid2'] = $new_dinamic['itemid'];
+								}
+								else{
+									$graph['ymin_type2'] = GRAPH_YAXIS_TYPE_CALCULATED;
+								}
+							}
 						}
 
 
