Index: include/classes/graphdraw/CLineGraphDraw.php
===================================================================
--- include/classes/graphdraw/CLineGraphDraw.php	(revision 55773)
+++ include/classes/graphdraw/CLineGraphDraw.php	(working copy)
@@ -1866,15 +1866,15 @@
 
 			// draw color square
 			if (function_exists('imagecolorexactalpha') && function_exists('imagecreatetruecolor') && @imagecreatetruecolor(1, 1)) {
-				$colorSquare = imagecreatetruecolor(11, 11);
+				$colorSquareArrow = imagecreatetruecolor(21, 11);
 			}
 			else {
-				$colorSquare = imagecreate(11, 11);
+				$colorSquareArrow = imagecreate(21, 11);
 			}
 
-			imagefill($colorSquare, 0, 0, $this->getColor($this->graphtheme['backgroundcolor'], 0));
-			imagefilledrectangle($colorSquare, 0, 0, 10, 10, $color);
-			imagerectangle($colorSquare, 0, 0, 10, 10, $this->getColor('Black'));
+			imagefill($colorSquareArrow, 0, 0, $this->getColor($this->graphtheme['backgroundcolor'], 0));
+			$squareArrowPointsR = array(5, 0, 15, 0, 20, 5, 15, 10, 5, 10);
+			$squareArrowPointsL = array(5, 0, 15, 0, 15, 10, 5, 10, 0, 5);
 
 			// caption
 			$itemCaption = $this->itemsHost
@@ -1882,18 +1882,24 @@
 				: $this->items[$i]['hostname'].NAME_DELIMITER.$this->items[$i]['name_expanded'];
 
 			// draw legend of an item with data
-			if (isset($data) && isset($data['min'])) {
+				if (isset($data) && isset($data['min'])) {
+				
+
 				if ($this->items[$i]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
 					$units['left'] = $this->items[$i]['units'];
+					imagefilledpolygon($colorSquareArrow, $squareArrowPointsL, 5, $color);
+					imagepolygon($colorSquareArrow, $squareArrowPointsL, 5, $this->getColor('Black'));
 				}
 				else {
 					$units['right'] = $this->items[$i]['units'];
+					imagefilledpolygon($colorSquareArrow, $squareArrowPointsR, 5, $color);
+					imagepolygon($colorSquareArrow, $squareArrowPointsR, 5, $this->getColor('Black'));
 				}
-
-				$legend->addCell($rowNum, array('image' => $colorSquare, 'marginRight' => 5));
+				$legend->addCell($rowNum, array('image' => $colorSquareArrow, 'marginRight' => 5));
 				$legend->addCell($rowNum, array('text' => $itemCaption));
 				$legend->addCell($rowNum, array('text' => '['.$fncRealName.']'));
 				$legend->addCell($rowNum, array(
+
 					'text' => convert_units(array(
 						'value' => $this->getLastValue($i),
 						'units' => $this->items[$i]['units'],
@@ -1928,7 +1934,17 @@
 			}
 			// draw legend of an item without data
 			else {
-				$legend->addCell($rowNum, array('image' => $colorSquare, 'marginRight' => 5));
+				if ($this->items[$i]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
+					$units['left'] = $this->items[$i]['units'];
+					imagefilledpolygon($colorSquareArrow, $squareArrowPointsL, 5, $color);
+					imagepolygon($colorSquareArrow, $squareArrowPointsL, 5, $this->getColor('Black'));
+				}
+				else {
+					$units['right'] = $this->items[$i]['units'];
+					imagefilledpolygon($colorSquareArrow, $squareArrowPointsR, 5, $color);
+					imagepolygon($colorSquareArrow, $squareArrowPointsR, 5, $this->getColor('Black'));
+				}
+				$legend->addCell($rowNum, array('image' => $colorSquareArrow, 'marginRight' => 5));
 				$legend->addCell($rowNum, array('text' => $itemCaption));
 				$legend->addCell($rowNum, array('text' => '['._('no data').']'));
 			}
@@ -1954,7 +1970,7 @@
 
 		$legend = new CImageTextTable(
 			$this->im,
-			$leftXShift + 10,
+			$leftXShift + 20,
 			$this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY
 		);
 		$legend->color = $this->getColor($this->graphtheme['textcolor'], 0);
@@ -1971,22 +1987,26 @@
 						'units' => $units[$side]
 					));
 					$legend->addCell($rowNum, array(
-						'text' => $percentile['percent'].'th percentile: '.$convertedUnit.' ('.$side.')',
+						'text' => $percentile['percent'].'th percentile: '.$convertedUnit.'',
 						ITEM_CONVERT_NO_UNITS
 					));
 					if ($side == 'left') {
 						$color = $this->graphtheme['leftpercentilecolor'];
+						$leftXShiftMoveL = 10;
+						$leftXShiftMoveR = 0;
 					}
 					else {
 						$color = $this->graphtheme['rightpercentilecolor'];
+						$leftXShiftMoveL = 0;
+						$leftXShiftMoveR = 10;
 					}
 
 					imagefilledpolygon(
 						$this->im,
 						array(
-							$leftXShift + 5, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
-							$leftXShift - 5, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
-							$leftXShift, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY - 10
+							$leftXShift + $leftXShiftMoveL, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY - 10,
+							$leftXShift + $leftXShiftMoveL, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
+							$leftXShift + $leftXShiftMoveR, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY - 5
 						),
 						3,
 						$this->getColor($color)
@@ -1995,9 +2015,9 @@
 					imagepolygon(
 						$this->im,
 						array(
-							$leftXShift + 5, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
-							$leftXShift - 5, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
-							$leftXShift, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY - 10
+							$leftXShift + $leftXShiftMoveL, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY - 10,
+							$leftXShift + $leftXShiftMoveL, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
+							$leftXShift + $leftXShiftMoveR, $this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY - 5
 						),
 						3,
 						$this->getColor('Black No Alpha')
@@ -2011,7 +2031,7 @@
 
 		$legend = new CImageTextTable(
 			$this->im,
-			$leftXShift + 10,
+			$leftXShift + 20,
 			$this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY + 5
 		);
 		$legend->color = $this->getColor($this->graphtheme['textcolor'], 0);
@@ -2022,7 +2042,7 @@
 		foreach ($this->triggers as $trigger) {
 			imagefilledellipse(
 				$this->im,
-				$leftXShift,
+				$leftXShift + 5,
 				$this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
 				10,
 				10,
@@ -2031,7 +2051,7 @@
 
 			imageellipse(
 				$this->im,
-				$leftXShift,
+				$leftXShift + 5,
 				$this->sizeY + $this->shiftY + 14 * $rowNum + $this->legendOffsetY,
 				10,
 				10,
 
