/** * Draw a sample for use with legend * @param int $x The x coordinate to draw the sample at * @param int $y The y coordinate to draw the sample at * @access private */ function _legendSample($x, $y, &$font) { if (is_a($this->_fillStyle, "Image_Graph_Fill")) { $fillStyle = $this->_fillStyle->_getFillStyleAt($x -5, $y -5, 10, 10); } else { $fillStyle = $this->_getFillStyle(); } if ($fillStyle != IMG_COLOR_TRANSPARENT) { ImageFilledRectangle($this->_canvas(), $x -5, $y -5, $x +5, $y +5, $fillStyle); ImageRectangle($this->_canvas(), $x -5, $y -5, $x +5, $y +5, $this->_getLineStyle()); } else { ImageLine($this->_canvas(), $x -7, $y, $x +7, $y, $this->_getLineStyle()); } if (($this->_marker) and ($this->_dataset)) { $this->_dataset->_reset(); $point = $this->_dataset->_next(); $prevPoint = $this->_dataset->_nearby(-2); $nextPoint = $this->_dataset->_nearby(); $point = $this->_getMarkerData($point, $nextPoint, $prevPoint, $i); if (is_array($point)) { $point['MARKER_X'] = $x; $point['MARKER_Y'] = $y; unset ($point['AVERAGE_Y']); $this->_marker->_drawMarker($point['MARKER_X'], $point['MARKER_Y'], $point); } } $text = new Image_Graph_Text($x + 20, $y, $this->_title, $font); $text->setAlignment(IMAGE_GRAPH_ALIGN_CENTER_Y | IMAGE_GRAPH_ALIGN_LEFT); $this->add($text); $text->_done(); return array('Width' => 20+$font->width($this->_title), 'Height' => max(10, $font->height($this->_title))); }