diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-09-19 13:29:02 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-09-19 13:29:02 +0000 |
commit | fe13be6dac3b9a019cd4ee7a4e1b3272ef922871 (patch) | |
tree | 3ac7e934fb907911583e4bd4c48aec7dc12bde95 | |
parent | 27cffe45cdf9cc6d36751bcc998459ae9d8a1f4b (diff) | |
download | zetacomponents-graph-fe13be6dac3b9a019cd4ee7a4e1b3272ef922871.zip zetacomponents-graph-fe13be6dac3b9a019cd4ee7a4e1b3272ef922871.tar.gz |
- Added background and border to font configuration
- Show value for highlighted datapoints in bar and line charts
26 files changed, 934 insertions, 79 deletions
diff --git a/src/charts/line.php b/src/charts/line.php index 6d6f381..9732205 100644 --- a/src/charts/line.php +++ b/src/charts/line.php @@ -25,6 +25,7 @@ class ezcGraphLineChart extends ezcGraphChart public function __construct( array $options = array() ) { $this->options = new ezcGraphLineChartOptions( $options ); + $this->options->highlightFont = $this->options->font; parent::__construct(); @@ -152,6 +153,22 @@ class ezcGraphLineChart extends ezcGraphChart $yAxisNullPosition ); + if ( $data->highlight[$key] ) + { + $renderer->drawDataHighlightText( + $boundings, + new ezcGraphContext( $datasetName, $key ), + $point, + $yAxisNullPosition, + $nr[$data->displayType->default], + $count[$data->displayType->default], + $this->options->highlightFont, + $value, + $this->options->highlightSize, + ( $this->options->highlightLines ? $data->color[$key] : null ) + ); + } + $lastPoint = $point; } break; @@ -176,7 +193,7 @@ class ezcGraphLineChart extends ezcGraphChart $boundings, new ezcGraphContext( $datasetName, $key ), $data->color->default, - $this->elements['xAxis']->axisLabelRenderer->modifyChartDataPosition( + $point = $this->elements['xAxis']->axisLabelRenderer->modifyChartDataPosition( $this->elements['yAxis']->axisLabelRenderer->modifyChartDataPosition( $point ) @@ -187,6 +204,22 @@ class ezcGraphLineChart extends ezcGraphChart $data->symbol[$key], $yAxisNullPosition ); + + if ( $data->highlight[$key] ) + { + $renderer->drawDataHighlightText( + $boundings, + new ezcGraphContext( $datasetName, $key ), + $point, + $yAxisNullPosition, + $nr[$data->displayType->default], + $count[$data->displayType->default], + $this->options->highlightFont, + $value, + $this->options->highlightSize, + ( $this->options->highlightLines ? $data->color[$key] : null ) + ); + } } break; default: diff --git a/src/driver/gd.php b/src/driver/gd.php index 1e30e81..8629bfd 100644 --- a/src/driver/gd.php +++ b/src/driver/gd.php @@ -384,12 +384,18 @@ class ezcGraphGdDriver extends ezcGraphDriver public function drawTextBox( $string, ezcGraphCoordinate $position, $width, $height, $align ) { // Test font - // @TODO: try to find font at standard locations if no path was provided if ( !is_file( $this->options->font->path ) || !is_readable( $this->options->font->path ) ) { throw new ezcGraphGdDriverInvalidFontException( $this->options->font->path ); } + $padding = $this->options->font->padding + ( $this->options->font->border !== false ? $this->options->font->borderWidth : 0 ); + + $width -= $padding * 2; + $height -= $padding * 2; + $position->x += $padding; + $position->y += $padding; + // Try to get a font size for the text to fit into the box $maxSize = min( $height, $this->options->font->maxFontSize ); $result = false; @@ -453,6 +459,94 @@ class ezcGraphGdDriver extends ezcGraphDriver break; } + $padding = $text['font']->padding + $text['font']->borderWidth / 2; + if ( $this->options->font->minimizeBorder === true ) + { + // Calculate maximum width of text rows + $width = false; + foreach ( $text['text'] as $line ) + { + $string = implode( ' ', $line ); + $boundings = $this->getTextBoundings( $size, $text['font'], $string ); + if ( ( $width === false) || ( $boundings->width > $width ) ) + { + $width = $boundings->width; + } + } + + switch ( true ) + { + case ( $text['align'] & ezcGraph::LEFT ): + $xOffset = 0; + break; + case ( $text['align'] & ezcGraph::CENTER ): + $xOffset = ( $text['width'] - $width ) / 2; + break; + case ( $text['align'] & ezcGraph::RIGHT ): + $xOffset = $text['width'] - $width; + break; + } + + $borderPolygonArray = array( + new ezcGraphCoordinate( + $text['position']->x - $padding + $xOffset, + $text['position']->y - $padding + $yOffset + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $xOffset + $width, + $text['position']->y - $padding + $yOffset + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $xOffset + $width, + $text['position']->y + $padding * 2 + $yOffset + $completeHeight + ), + new ezcGraphCoordinate( + $text['position']->x - $padding + $xOffset, + $text['position']->y + $padding * 2 + $yOffset + $completeHeight + ), + ); + } + else + { + $borderPolygonArray = array( + new ezcGraphCoordinate( + $text['position']->x - $padding, + $text['position']->y - $padding + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $text['width'], + $text['position']->y - $padding + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $text['width'], + $text['position']->y + $padding * 2 + $text['height'] + ), + new ezcGraphCoordinate( + $text['position']->x - $padding, + $text['position']->y + $padding * 2 + $text['height'] + ), + ); + } + + if ( $text['font']->background !== false ) + { + $this->drawPolygon( + $borderPolygonArray, + $text['font']->background, + true + ); + } + + if ( $text['font']->border !== false ) + { + $this->drawPolygon( + $borderPolygonArray, + $text['font']->border, + false, + $text['font']->borderWidth + ); + } + // Render text with evaluated font size foreach ( $text['text'] as $line ) { diff --git a/src/driver/svg.php b/src/driver/svg.php index bcdd1a2..9fa4e5c 100644 --- a/src/driver/svg.php +++ b/src/driver/svg.php @@ -408,6 +408,13 @@ class ezcGraphSvgDriver extends ezcGraphDriver */ public function drawTextBox( $string, ezcGraphCoordinate $position, $width, $height, $align ) { + $padding = $this->options->font->padding + ( $this->options->font->border !== false ? $this->options->font->borderWidth : 0 ); + + $width -= $padding * 2; + $height -= $padding * 2; + $position->x += $padding; + $position->y += $padding; + // Try to get a font size for the text to fit into the box $maxSize = min( $height, $this->options->font->maxFontSize ); $result = false; @@ -428,7 +435,7 @@ class ezcGraphSvgDriver extends ezcGraphDriver 'width' => $width, 'height' => $height, 'align' => $align, - 'options' => $this->options->font, + 'font' => $this->options->font, ); return $id; @@ -438,8 +445,8 @@ class ezcGraphSvgDriver extends ezcGraphDriver { foreach ( $this->strings as $text ) { - $size = $text['options']->minimalUsedFont; - $font = $text['options']->name; + $size = $text['font']->minimalUsedFont; + $font = $text['font']->name; $completeHeight = count( $text['text'] ) * $size + ( count( $text['text'] ) - 1 ) * $this->options->lineSpacing; @@ -458,6 +465,93 @@ class ezcGraphSvgDriver extends ezcGraphDriver break; } + $padding = $text['font']->padding + $text['font']->borderWidth / 2; + if ( $this->options->font->minimizeBorder === true ) + { + // Calculate maximum width of text rows + $width = false; + foreach ( $text['text'] as $line ) + { + $string = implode( ' ', $line ); + if ( ( $strWidth = ( $size * strlen( $string ) * $this->options->assumedCharacterWidth ) ) > $width ) + { + $width = $strWidth; + } + } + + switch ( true ) + { + case ( $text['align'] & ezcGraph::LEFT ): + $xOffset = 0; + break; + case ( $text['align'] & ezcGraph::CENTER ): + $xOffset = ( $text['width'] - $width ) / 2; + break; + case ( $text['align'] & ezcGraph::RIGHT ): + $xOffset = $text['width'] - $width; + break; + } + + $borderPolygonArray = array( + new ezcGraphCoordinate( + $text['position']->x - $padding + $xOffset, + $text['position']->y - $padding + $yOffset + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $xOffset + $width, + $text['position']->y - $padding + $yOffset + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $xOffset + $width, + $text['position']->y + $padding * 2 + $yOffset + $completeHeight + ), + new ezcGraphCoordinate( + $text['position']->x - $padding + $xOffset, + $text['position']->y + $padding * 2 + $yOffset + $completeHeight + ), + ); + } + else + { + $borderPolygonArray = array( + new ezcGraphCoordinate( + $text['position']->x - $padding, + $text['position']->y - $padding + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $text['width'], + $text['position']->y - $padding + ), + new ezcGraphCoordinate( + $text['position']->x + $padding * 2 + $text['width'], + $text['position']->y + $padding * 2 + $text['height'] + ), + new ezcGraphCoordinate( + $text['position']->x - $padding, + $text['position']->y + $padding * 2 + $text['height'] + ), + ); + } + + if ( $text['font']->background !== false ) + { + $this->drawPolygon( + $borderPolygonArray, + $text['font']->background, + true + ); + } + + if ( $text['font']->border !== false ) + { + $this->drawPolygon( + $borderPolygonArray, + $text['font']->border, + false, + $text['font']->borderWidth + ); + } + // Render text with evaluated font size foreach ( $text['text'] as $line ) { @@ -496,11 +590,11 @@ class ezcGraphSvgDriver extends ezcGraphDriver sprintf( 'font-size: %dpx; font-family: %s; fill: #%02x%02x%02x; fill-opacity: %.2f; stroke: none;', $size, - $text['options']->name, - $text['options']->color->red, - $text['options']->color->green, - $text['options']->color->blue, - 1 - ( $text['options']->color->alpha / 255 ) + $text['font']->name, + $text['font']->color->red, + $text['font']->color->green, + $text['font']->color->blue, + 1 - ( $text['font']->color->alpha / 255 ) ) ); diff --git a/src/interfaces/renderer.php b/src/interfaces/renderer.php index 84907e0..46b5301 100644 --- a/src/interfaces/renderer.php +++ b/src/interfaces/renderer.php @@ -148,6 +148,36 @@ abstract class ezcGraphRenderer $axisPosition = 0., $thickness = 1 ); + + /** + * Draws a highlight textbox for a datapoint. + * + * A highlight textbox for line and bar charts means a box with the current + * value in the graph. + * + * @param ezcGraphBoundings $boundings Chart boundings + * @param ezcGraphContext $context Context of call + * @param ezcGraphCoordinate $end Ending point + * @param float $axisPosition Position of axis for drawing filled lines + * @param int $dataNumber Number of dataset + * @param int $dataCount Count of datasets in chart + * @param ezcGraphFontOptions $font Font used for highlight string + * @param string $text Acutual value + * @param int $size Size of highlight text + * @return void + */ + abstract public function drawDataHighlightText( + ezcGraphBoundings $boundings, + ezcGraphContext $context, + ezcGraphCoordinate $end, + $axisPosition = 0., + $dataNumber = 1, + $dataCount = 1, + ezcGraphFontOptions $font, + $text, + $size, + ezcGraphColor $markLines = null + ); /** * Draw legend diff --git a/src/options/font.php b/src/options/font.php index 2da92ad..f746f73 100644 --- a/src/options/font.php +++ b/src/options/font.php @@ -19,7 +19,6 @@ * - TTF_FONT Native TTF fonts * - PS_FONT PostScript Type1 fonts * - FT2_FONT FreeType 2 fonts - * - GD_FONT Native GD bitmap fonts * @property float $minFontSize * Minimum font size for displayed texts. * @property float $maxFontSize @@ -30,6 +29,18 @@ * Font color. * @property float $lineSpacing * Percent of font size used for line spacing + * @property ezcGraphColor $background + * Background color + * @property ezcGraphColor $border + * Border color + * @property int $borderWidth + * Border width + * @property int $padding + * Padding between text and border + * @property bool $minimizeBorder + * Fit the border exactly around the text, or use the complete + * possible space. + * * * @package Graph */ @@ -54,6 +65,12 @@ class ezcGraphFontOptions extends ezcBaseOptions $this->properties['lineSpacing'] = .1; $this->properties['color'] = ezcGraphColor::fromHex( '#000000' ); + $this->properties['background'] = false; + $this->properties['border'] = false; + $this->properties['borderWidth'] = 1; + $this->properties['padding'] = 0; + $this->properties['minimizeBorder'] = true; + parent::__construct( $options ); } @@ -93,6 +110,37 @@ class ezcGraphFontOptions extends ezcBaseOptions throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphColor' ); } break; + + case 'background': + if ( $propertyValue instanceof ezcGraphColor ) + { + $this->properties['background'] = $propertyValue; + } + else + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphColor' ); + } + break; + case 'border': + if ( $propertyValue instanceof ezcGraphColor ) + { + $this->properties['border'] = $propertyValue; + } + else + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'ezcGraphColor' ); + } + break; + case 'borderWidth': + $this->properties['borderWidth'] = (int) $propertyValue; + break; + case 'padding': + $this->properties['padding'] = (int) $propertyValue; + break; + case 'minimizeBorder': + $this->properties['minimizeBorder'] = (bool) $propertyValue; + break; + case 'name': if ( is_string( $propertyValue ) ) { diff --git a/src/options/line_chart.php b/src/options/line_chart.php index 358f82a..c8eadb5 100644 --- a/src/options/line_chart.php +++ b/src/options/line_chart.php @@ -18,6 +18,13 @@ * - (int) Opacity used to fill up the space with the lines color. * @property int $symbolSize * Size of symbols in line chart. + * @property ezcGraphFontOptions $highlightFont + * Font configuration for highlight tests + * @property int $highlightSize + * Size of highlight blocks + * @property bool $highlightLines + * If true, it adds lines to highlight the values position on the + * axis. * * @package Graph */ @@ -35,7 +42,11 @@ class ezcGraphLineChartOptions extends ezcGraphChartOptions $this->properties['lineThickness'] = 2; $this->properties['fillLines'] = false; $this->properties['symbolSize'] = 8; - + $this->properties['highlightFont'] = new ezcGraphFontOptions(); + $this->properties['highlightFontCloned'] = false; + $this->properties['highlightSize'] = 14; + $this->properties['highlightLines'] = false; + parent::__construct( $options ); } @@ -68,10 +79,62 @@ class ezcGraphLineChartOptions extends ezcGraphChartOptions case 'symbolSize': $this->properties['symbolSize'] = max( 1, (int) $propertyValue ); break; + case 'highlightFont': + if ( $propertyValue instanceof ezcGraphFontOptions ) + { + $this->properties['highlightFont'] = $propertyValue; + } + elseif ( is_string( $propertyValue ) ) + { + if ( !$this->properties['highlightFontCloned'] ) + { + $this->properties['highlightFont'] = clone $this->font; + $this->properties['highlightFontCloned'] = true; + } + + $this->properties['highlightFont']->font = $propertyValue; + } + else + { + throw new ezcBaseValueException( $propertyValue, 'ezcGraphFontOptions' ); + } + break; + case 'highlightSize': + $this->properties['highlightSize'] = max( 1, (int) $propertyValue ); + break; + case 'highlightLines': + $this->properties['highlightLines'] = (bool) $propertyValue; + break; default: return parent::__set( $propertyName, $propertyValue ); } } + + /** + * __get + * + * @param mixed $propertyName + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @return mixed + * @ignore + */ + public function __get( $propertyName ) + { + switch ( $propertyName ) + { + case 'highlightFont': + // Clone font configuration when requested for this element + if ( !$this->properties['highlightFontCloned'] ) + { + $this->properties['highlightFont'] = clone $this->properties['font']; + $this->properties['highlightFontCloned'] = true; + } + return $this->properties['highlightFont']; + default: + return parent::__get( $propertyName ); + } + } } ?> diff --git a/src/options/svg_driver.php b/src/options/svg_driver.php index 4a83ca4..53d73d8 100644 --- a/src/options/svg_driver.php +++ b/src/options/svg_driver.php @@ -57,7 +57,7 @@ class ezcGraphSvgDriverOptions extends ezcGraphDriverOptions */ public function __construct( array $options = array() ) { - $this->properties['assumedCharacterWidth'] = .55; + $this->properties['assumedCharacterWidth'] = .55; // @TODO .6 seems to fit better $this->properties['strokeLineJoin'] = 'round'; $this->properties['strokeLineCap'] = 'round'; $this->properties['shapeRendering'] = 'geometricPrecision'; diff --git a/src/renderer/2d.php b/src/renderer/2d.php index e038aeb..57de7bd 100644 --- a/src/renderer/2d.php +++ b/src/renderer/2d.php @@ -72,14 +72,14 @@ class ezcGraphRenderer2d extends ezcGraphRenderer { // Calculate position and size of pie $center = new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) / 2, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) / 2 + $boundings->x0 + ( $boundings->width ) / 2, + $boundings->y0 + ( $boundings->height ) / 2 ); // Limit radius to fourth of width and half of height at maximum $radius = min( - ( $boundings->x1 - $boundings->x0 ) * $this->options->pieHorizontalSize, - ( $boundings->y1 - $boundings->y0 ) / $this->options->pieVerticalSize + ( $boundings->width ) * $this->options->pieHorizontalSize, + ( $boundings->height ) * $this->options->pieVerticalSize ) * ( 1 - $this->options->moveOut ); // Move pie segment out of the center @@ -193,21 +193,21 @@ class ezcGraphRenderer2d extends ezcGraphRenderer // Calculate position and size of pie $center = new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) / 2, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) / 2 + $boundings->x0 + ( $boundings->width ) / 2, + $boundings->y0 + ( $boundings->height ) / 2 ); // Limit radius to fourth of width and half of height at maximum $radius = min( - ( $boundings->x1 - $boundings->x0 ) / 4, - ( $boundings->y1 - $boundings->y0 ) / 2 + ( $boundings->width ) / 4, + ( $boundings->height ) / 2 ); $pieChartHeight = min( $radius * 2 + $this->options->maxLabelHeight * 2, - $boundings->y1 - $boundings->y0 + $boundings->height ); - $pieChartYPosition = $boundings->y0 + ( ( $boundings->y1 - $boundings->y0 ) - $pieChartHeight ) / 2; + $pieChartYPosition = $boundings->y0 + ( ( $boundings->height ) - $pieChartHeight ) / 2; // Calculate maximum height of labels $labelHeight = (int) round( min( @@ -219,7 +219,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer ? $pieChartHeight / count( $this->pieSegmentLabels[1] ) : $pieChartHeight ), - ( $boundings->y1 - $boundings->y0 ) * $this->options->maxLabelHeight + ( $boundings->height ) * $this->options->maxLabelHeight ) ); $symbolSize = $this->options->symbolSize; @@ -351,20 +351,20 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $barPointArray = array( new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition + $boundings->x0 + ( $boundings->width ) * $position->x + $offset, + $boundings->y0 + ( $boundings->height ) * $axisPosition ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $position->y + $boundings->x0 + ( $boundings->width ) * $position->x + $offset, + $boundings->y0 + ( $boundings->height ) * $position->y ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset + $barWidth, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $position->y + $boundings->x0 + ( $boundings->width ) * $position->x + $offset + $barWidth, + $boundings->y0 + ( $boundings->height ) * $position->y ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $position->x + $offset + $barWidth, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition + $boundings->x0 + ( $boundings->width ) * $position->x + $offset + $barWidth, + $boundings->y0 + ( $boundings->height ) * $axisPosition ), ); @@ -437,20 +437,20 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $this->driver->drawPolygon( array( new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $start->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $start->y + $boundings->x0 + ( $boundings->width ) * $start->x, + $boundings->y0 + ( $boundings->height ) * $start->y ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $end->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $end->y + $boundings->x0 + ( $boundings->width ) * $end->x, + $boundings->y0 + ( $boundings->height ) * $end->y ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $end->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition + $boundings->x0 + ( $boundings->width ) * $end->x, + $boundings->y0 + ( $boundings->height ) * $axisPosition ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $start->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition + $boundings->x0 + ( $boundings->width ) * $start->x, + $boundings->y0 + ( $boundings->height ) * $axisPosition ), ), $fillColor, @@ -472,16 +472,16 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $this->driver->drawPolygon( array( new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $start->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition + $boundings->x0 + ( $boundings->width ) * $start->x, + $boundings->y0 + ( $boundings->height ) * $axisPosition ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $start->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $start->y + $boundings->x0 + ( $boundings->width ) * $start->x, + $boundings->y0 + ( $boundings->height ) * $start->y ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $cuttingPoint->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $cuttingPoint->y + $boundings->x0 + ( $boundings->width ) * $cuttingPoint->x, + $boundings->y0 + ( $boundings->height ) * $cuttingPoint->y ), ), $fillColor, @@ -491,16 +491,16 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $this->driver->drawPolygon( array( new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $end->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $axisPosition + $boundings->x0 + ( $boundings->width ) * $end->x, + $boundings->y0 + ( $boundings->height ) * $axisPosition ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $end->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $end->y + $boundings->x0 + ( $boundings->width ) * $end->x, + $boundings->y0 + ( $boundings->height ) * $end->y ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $cuttingPoint->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $cuttingPoint->y + $boundings->x0 + ( $boundings->width ) * $cuttingPoint->x, + $boundings->y0 + ( $boundings->height ) * $cuttingPoint->y ), ), $fillColor, @@ -512,12 +512,12 @@ class ezcGraphRenderer2d extends ezcGraphRenderer // Draw line $this->driver->drawLine( new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $start->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $start->y + $boundings->x0 + ( $boundings->width ) * $start->x, + $boundings->y0 + ( $boundings->height ) * $start->y ), new ezcGraphCoordinate( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $end->x, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $end->y + $boundings->x0 + ( $boundings->width ) * $end->x, + $boundings->y0 + ( $boundings->height ) * $end->y ), $color, $thickness @@ -533,10 +533,10 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $this->linePostSymbols[] = array( 'boundings' => new ezcGraphBoundings( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $end->x - $this->options->symbolSize / 2, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $end->y - $this->options->symbolSize / 2, - $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $end->x + $this->options->symbolSize / 2, - $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $end->y + $this->options->symbolSize / 2 + $boundings->x0 + ( $boundings->width ) * $end->x - $this->options->symbolSize / 2, + $boundings->y0 + ( $boundings->height ) * $end->y - $this->options->symbolSize / 2, + $boundings->x0 + ( $boundings->width ) * $end->x + $this->options->symbolSize / 2, + $boundings->y0 + ( $boundings->height ) * $end->y + $this->options->symbolSize / 2 ), 'color' => $symbolColor, 'context' => $context, @@ -546,6 +546,71 @@ class ezcGraphRenderer2d extends ezcGraphRenderer } /** + * Draws a highlight textbox for a datapoint. + * + * A highlight textbox for line and bar charts means a box with the current + * value in the graph. + * + * @param ezcGraphBoundings $boundings Chart boundings + * @param ezcGraphContext $context Context of call + * @param ezcGraphCoordinate $end Ending point + * @param float $axisPosition Position of axis for drawing filled lines + * @param int $dataNumber Number of dataset + * @param int $dataCount Count of datasets in chart + * @param ezcGraphFontOptions $font Font used for highlight string + * @param string $text Acutual value + * @param int $size Size of highlight text + * @return void + */ + public function drawDataHighlightText( + ezcGraphBoundings $boundings, + ezcGraphContext $context, + ezcGraphCoordinate $end, + $axisPosition = 0., + $dataNumber = 1, + $dataCount = 1, + ezcGraphFontOptions $font, + $text, + $size, + ezcGraphColor $markLines = null ) + { + $this->driver->options->font = $font; + $width = $boundings->width / $dataCount; + + $dataPoint = new ezcGraphCoordinate( + $boundings->x0 + ( $boundings->width ) * $end->x, + $boundings->y0 + ( $boundings->height ) * $end->y + ); + + if ( $end->y < $axisPosition ) + { + $this->driver->drawTextBox( + $text, + new ezcGraphCoordinate( + $dataPoint->x - $width / 2, + $dataPoint->y - $size - $font->padding - $this->options->symbolSize + ), + $width, + $size, + ezcGraph::CENTER | ezcGraph::BOTTOM + ); + } + else + { + $this->driver->drawTextBox( + $text, + new ezcGraphCoordinate( + $dataPoint->x - $width / 2, + $dataPoint->y + $font->padding + $this->options->symbolSize + ), + $width, + $size, + ezcGraph::CENTER | ezcGraph::TOP + ); + } + } + + /** * Draw legend * * Will draw a legend in the bounding box @@ -565,17 +630,17 @@ class ezcGraphRenderer2d extends ezcGraphRenderer // Calculate boundings of each label if ( $type & ezcGraph::VERTICAL ) { - $labelWidth = $boundings->x1 - $boundings->x0; + $labelWidth = $boundings->width; $labelHeight = min( - ( $boundings->y1 - $boundings->y0 ) / count( $labels ) - $legend->spacing, + ( $boundings->height ) / count( $labels ) - $legend->spacing, $legend->symbolSize + 2 * $legend->padding ); } else { - $labelWidth = ( $boundings->x1 - $boundings->x0 ) / count( $labels ) - $legend->spacing; + $labelWidth = ( $boundings->width ) / count( $labels ) - $legend->spacing; $labelHeight = min( - $boundings->x1 - $boundings->x0, + $boundings->width, $legend->symbolSize + 2 * $legend->padding ); } @@ -699,7 +764,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $this->driver->drawTextBox( $title, new ezcGraphCoordinate( $boundings->x0, $boundings->y0 ), - $boundings->x1 - $boundings->x0, + $boundings->width, $titleSize, $this->options->titleAlignement ); @@ -711,7 +776,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $this->driver->drawTextBox( $title, new ezcGraphCoordinate( $boundings->x0, $boundings->y1 - $titleSize ), - $boundings->x1 - $boundings->x0, + $boundings->width, $titleSize, $this->options->titleAlignement ); @@ -742,8 +807,8 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $this->driver->drawTextBox( $text, new ezcGraphCoordinate( $boundings->x0, $boundings->y0 ), - $boundings->x1 - $boundings->x0, - $boundings->y1 - $boundings->y0, + $boundings->width, + $boundings->height, $align ); } @@ -831,11 +896,11 @@ class ezcGraphRenderer2d extends ezcGraphRenderer { case ezcGraph::TOP: case ezcGraph::BOTTOM: - $this->xAxisSpace = ( $boundings->x1 - $boundings->x0 ) * $axis->axisSpace; + $this->xAxisSpace = ( $boundings->width ) * $axis->axisSpace; break; case ezcGraph::LEFT: case ezcGraph::RIGHT: - $this->yAxisSpace = ( $boundings->y1 - $boundings->y0 ) * $axis->axisSpace; + $this->yAxisSpace = ( $boundings->height ) * $axis->axisSpace; break; } @@ -900,7 +965,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer // Draw axis label if ( $axis->label !== false ) { - $width = $boundings->x1 - $boundings->x0; + $width = $boundings->width; switch ( $axis->position ) { case ezcGraph::TOP: @@ -1014,8 +1079,8 @@ class ezcGraphRenderer2d extends ezcGraphRenderer $imageWidth = $imageData[0]; $imageHeight = $imageData[1]; - $imageWidth = min( $imageWidth, $boundings->x1 - $boundings->x0 ); - $imageHeight = min( $imageHeight, $boundings->y1 - $boundings->y0 ); + $imageWidth = min( $imageWidth, $boundings->width ); + $imageHeight = min( $imageHeight, $boundings->height ); $imagePosition = new ezcGraphCoordinate( $boundings->x0, @@ -1037,7 +1102,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer break; default: $imagePosition->x = max( - $boundings->x0 + ( $boundings->x1 - $boundings->x0 - $imageWidth ) / 2, + $boundings->x0 + ( $boundings->width - $imageWidth ) / 2, $boundings->x0 ); break; @@ -1058,7 +1123,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer break; default: $imagePosition->y = max( - $boundings->y0 + ( $boundings->y1 - $boundings->y0 - $imageHeight ) / 2, + $boundings->y0 + ( $boundings->height - $imageHeight ) / 2, $boundings->y0 ); break; diff --git a/src/renderer/3d.php b/src/renderer/3d.php index ffd382e..e30175c 100644 --- a/src/renderer/3d.php +++ b/src/renderer/3d.php @@ -1139,6 +1139,81 @@ class ezcGraphRenderer3d extends ezcGraphRenderer } /** + * Draws a highlight textbox for a datapoint. + * + * A highlight textbox for line and bar charts means a box with the current + * value in the graph. + * + * @param ezcGraphBoundings $boundings Chart boundings + * @param ezcGraphContext $context Context of call + * @param ezcGraphCoordinate $end Ending point + * @param float $axisPosition Position of axis for drawing filled lines + * @param int $dataNumber Number of dataset + * @param int $dataCount Count of datasets in chart + * @param ezcGraphFontOptions $font Font used for highlight string + * @param string $text Acutual value + * @param int $size Size of highlight text + * @return void + */ + public function drawDataHighlightText( + ezcGraphBoundings $boundings, + ezcGraphContext $context, + ezcGraphCoordinate $end, + $axisPosition = 0., + $dataNumber = 1, + $dataCount = 1, + ezcGraphFontOptions $font, + $text, + $size, + ezcGraphColor $markLines = null ) + { + $this->driver->options->font = $font; + $width = $this->dataBoundings->width / $dataCount; + + // Calculate line width based on options + if ( $this->options->seperateLines ) + { + $endDepth = ( 1 / $dataCount ) * ( $dataNumber + 1 ); + } + else + { + $endDepth = true; + } + + $dataPoint = new ezcGraphCoordinate( + $this->dataBoundings->x0 + $this->xAxisSpace + $end->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ), + $this->dataBoundings->y0 + $this->yAxisSpace + $end->y * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) ) + ); + + if ( $end->y < $axisPosition ) + { + $this->driver->drawTextBox( + $text, + $this->get3dCoordinate( new ezcGraphCoordinate( + $dataPoint->x - $width / 2, + $dataPoint->y - $size - $font->padding - $this->options->symbolSize + ), $endDepth ), + $width * $this->xDepthFactor, + $size, + ezcGraph::CENTER | ezcGraph::BOTTOM + ); + } + else + { + $this->driver->drawTextBox( + $text, + $this->get3dCoordinate( new ezcGraphCoordinate( + $dataPoint->x - $width / 2, + $dataPoint->y + $font->padding + $this->options->symbolSize + ), $endDepth ), + $width * $this->xDepthFactor, + $size, + ezcGraph::CENTER | ezcGraph::TOP + ); + } + } + + /** * Draw legend * * Will draw a legend in the bounding box diff --git a/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithBackground.png b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithBackground.png Binary files differnew file mode 100644 index 0000000..b40d162 --- /dev/null +++ b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithBackground.png diff --git a/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithBorder.png b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithBorder.png Binary files differnew file mode 100644 index 0000000..517ceb9 --- /dev/null +++ b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithBorder.png diff --git a/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundBottomRight.png b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundBottomRight.png Binary files differnew file mode 100644 index 0000000..39f1898 --- /dev/null +++ b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundBottomRight.png diff --git a/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter.png b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter.png Binary files differnew file mode 100644 index 0000000..797e162 --- /dev/null +++ b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter.png diff --git a/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundTopLeft.png b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundTopLeft.png Binary files differnew file mode 100644 index 0000000..8592407 --- /dev/null +++ b/tests/data/compare/ezcGraphGdDriverTest_testDrawTextWithMinimizedBorderAndBackgroundTopLeft.png diff --git a/tests/data/compare/ezcGraphRenderer2dTest_testRenderLineChartWithHighlightedData.svg b/tests/data/compare/ezcGraphRenderer2dTest_testRenderLineChartWithHighlightedData.svg new file mode 100644 index 0000000..f62fe67 --- /dev/null +++ b/tests/data/compare/ezcGraphRenderer2dTest_testRenderLineChartWithHighlightedData.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="500" height="200" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 0.0000,200.0000 L 0.0000,0.0000 L 500.0000,0.0000 L 500.0000,200.0000 L 0.0000,200.0000 z " style="fill: #2e3436; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_1"/><path d=" M 1.0000,199.0000 L 1.0000,1.0000 L 99.0000,1.0000 L 99.0000,199.0000 L 1.0000,199.0000 z " style="fill: none; stroke: #555753; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_2"/><path d=" M 2.0000,198.0000 L 2.0000,2.0000 L 98.0000,2.0000 L 98.0000,198.0000 L 2.0000,198.0000 z " style="fill: #000000; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_3"/><ellipse cx="11" cy="11" rx="7" ry="7" style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_4"/><ellipse cx="11" cy="29" rx="7" ry="7" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_6"/><path d=" M 100.0000,140.0000 L 500.0000,140.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_8"/><path d=" M 492.0000,144.0000 L 500.0000,140.0000 L 492.0000,136.0000 L 492.0000,144.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_9"/><path d=" M 140.0000,200.0000 L 140.0000,0.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_10"/><path d=" M 137.5000,5.0000 L 140.0000,0.0000 L 142.5000,5.0000 L 137.5000,5.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_11"/><path d=" M 204.0000,20.0000 L 204.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_13"/><path d=" M 204.0000,137.0000 L 204.0000,143.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_14"/><path d=" M 268.0000,20.0000 L 268.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_16"/><path d=" M 268.0000,137.0000 L 268.0000,143.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_17"/><path d=" M 332.0000,20.0000 L 332.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_19"/><path d=" M 332.0000,137.0000 L 332.0000,143.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_20"/><path d=" M 396.0000,20.0000 L 396.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_22"/><path d=" M 396.0000,137.0000 L 396.0000,143.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_23"/><path d=" M 460.0000,20.0000 L 460.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_25"/><path d=" M 460.0000,137.0000 L 460.0000,143.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_26"/><path d=" M 140.0000,180.0000 L 460.0000,180.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_27"/><path d=" M 140.0000,180.0000 L 143.0000,180.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_28"/><path d=" M 140.0000,100.0000 L 460.0000,100.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_31"/><path d=" M 140.0000,100.0000 L 143.0000,100.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_32"/><path d=" M 140.0000,60.0000 L 460.0000,60.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_34"/><path d=" M 140.0000,60.0000 L 143.0000,60.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_35"/><path d=" M 140.0000,20.0000 L 460.0000,20.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_37"/><path d=" M 140.0000,20.0000 L 143.0000,20.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_38"/><path d=" M 199.2425,140.0000 L 144.7575,140.0000 L 144.7575,102.5600 L 199.2425,102.5600 L 199.2425,140.0000 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_40"/><path d=" M 199.2425,140.0000 L 144.7575,140.0000 L 144.7575,102.5600 L 199.2425,102.5600 L 199.2425,140.0000 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_41"/><path d=" M 263.2425,140.0000 L 208.7575,140.0000 L 208.7575,143.3600 L 263.2425,143.3600 L 263.2425,140.0000 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_43"/><path d=" M 263.2425,140.0000 L 208.7575,140.0000 L 208.7575,143.3600 L 263.2425,143.3600 L 263.2425,140.0000 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_44"/><path d=" M 327.2425,140.0000 L 272.7575,140.0000 L 272.7575,88.1600 L 327.2425,88.1600 L 327.2425,140.0000 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_46"/><path d=" M 327.2425,140.0000 L 272.7575,140.0000 L 272.7575,88.1600 L 327.2425,88.1600 L 327.2425,140.0000 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_47"/><path d=" M 391.2425,140.0000 L 336.7575,140.0000 L 336.7575,159.2000 L 391.2425,159.2000 L 391.2425,140.0000 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_49"/><path d=" M 391.2425,140.0000 L 336.7575,140.0000 L 336.7575,159.2000 L 391.2425,159.2000 L 391.2425,140.0000 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_50"/><path d=" M 455.2425,140.0000 L 400.7575,140.0000 L 400.7575,139.8400 L 455.2425,139.8400 L 455.2425,140.0000 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_52"/><path d=" M 455.2425,140.0000 L 400.7575,140.0000 L 400.7575,139.8400 L 455.2425,139.8400 L 455.2425,140.0000 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_53"/><path d=" M 172.0000,53.1200 L 172.0000,53.1200" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_55"/><path d=" M 172.0000,53.1200 L 236.0000,102.5600" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_56"/><path d=" M 236.0000,102.5600 L 300.0000,92.3200" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_57"/><path d=" M 300.0000,92.3200 L 364.0000,139.2000" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_58"/><path d=" M 364.0000,139.2000 L 428.0000,41.9200" style="fill: none; stroke: #ef2929; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_59"/><ellipse cx="172" cy="53.12" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_61"/><ellipse cx="236" cy="102.56" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_62"/><ellipse cx="300" cy="92.32" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_63"/><ellipse cx="364" cy="139.2" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_64"/><ellipse cx="428" cy="41.92" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_65"/><text id="ezcGraphTextBox_5" x="19" text-length="46.2px" y="18" style="font-size: 14px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">Line 1</text><text id="ezcGraphTextBox_7" x="19" text-length="46.2px" y="36" style="font-size: 14px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">Line 2</text><text id="ezcGraphTextBox_12" x="143.4" text-length="57.2px" y="155" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 1</text><text id="ezcGraphTextBox_15" x="207.4" text-length="57.2px" y="155" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 2</text><text id="ezcGraphTextBox_18" x="271.4" text-length="57.2px" y="155" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 3</text><text id="ezcGraphTextBox_21" x="335.4" text-length="57.2px" y="155" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 4</text><text id="ezcGraphTextBox_24" x="399.4" text-length="57.2px" y="155" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 5</text><text id="ezcGraphTextBox_29" x="109.4" text-length="28.6px" y="178" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">-250</text><text id="ezcGraphTextBox_30" x="130.85" text-length="7.15px" y="138" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">0</text><text id="ezcGraphTextBox_33" x="116.55" text-length="21.45px" y="98" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">250</text><text id="ezcGraphTextBox_36" x="116.55" text-length="21.45px" y="58" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">500</text><text id="ezcGraphTextBox_39" x="116.55" text-length="21.45px" y="35" style="font-size: 13px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">750</text><path d=" M 163.2500,96.5600 L 163.2500,85.0600 L 181.2500,85.0600 L 181.2500,96.5600 L 163.2500,96.5600 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_66"/><path d=" M 163.2500,96.5600 L 163.2500,85.0600 L 181.2500,85.0600 L 181.2500,96.5600 L 163.2500,96.5600 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_67"/><text id="ezcGraphTextBox_42" x="163.75" text-length="16.5px" y="95.56" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">234</text><path d=" M 227.2500,161.3600 L 227.2500,149.8600 L 245.2500,149.8600 L 245.2500,161.3600 L 227.2500,161.3600 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_68"/><path d=" M 227.2500,161.3600 L 227.2500,149.8600 L 245.2500,149.8600 L 245.2500,161.3600 L 227.2500,161.3600 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_69"/><text id="ezcGraphTextBox_45" x="227.75" text-length="16.5px" y="160.36" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">-21</text><path d=" M 291.2500,82.1600 L 291.2500,70.6600 L 309.2500,70.6600 L 309.2500,82.1600 L 291.2500,82.1600 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_70"/><path d=" M 291.2500,82.1600 L 291.2500,70.6600 L 309.2500,70.6600 L 309.2500,82.1600 L 291.2500,82.1600 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_71"/><text id="ezcGraphTextBox_48" x="291.75" text-length="16.5px" y="81.16" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">324</text><path d=" M 352.5000,177.2000 L 352.5000,165.7000 L 376.0000,165.7000 L 376.0000,177.2000 L 352.5000,177.2000 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_72"/><path d=" M 352.5000,177.2000 L 352.5000,165.7000 L 376.0000,165.7000 L 376.0000,177.2000 L 352.5000,177.2000 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_73"/><text id="ezcGraphTextBox_51" x="353" text-length="22px" y="176.2" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">-120</text><path d=" M 424.7500,133.8400 L 424.7500,122.3400 L 431.7500,122.3400 L 431.7500,133.8400 L 424.7500,133.8400 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_74"/><path d=" M 424.7500,133.8400 L 424.7500,122.3400 L 431.7500,122.3400 L 431.7500,133.8400 L 424.7500,133.8400 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_75"/><text id="ezcGraphTextBox_54" x="425.25" text-length="5.5px" y="132.84" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">1</text><path d=" M 419.2500,35.9200 L 419.2500,24.4200 L 437.2500,24.4200 L 437.2500,35.9200 L 419.2500,35.9200 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_76"/><path d=" M 419.2500,35.9200 L 419.2500,24.4200 L 437.2500,24.4200 L 437.2500,35.9200 L 419.2500,35.9200 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_77"/><text id="ezcGraphTextBox_60" x="419.75" text-length="16.5px" y="34.92" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">613</text></g></svg> diff --git a/tests/data/compare/ezcGraphRenderer3dTest_testRenderLineChartWithHighlightedData.svg b/tests/data/compare/ezcGraphRenderer3dTest_testRenderLineChartWithHighlightedData.svg new file mode 100644 index 0000000..5739c43 --- /dev/null +++ b/tests/data/compare/ezcGraphRenderer3dTest_testRenderLineChartWithHighlightedData.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="500" height="200" version="1.0" id="ezcGraph"><defs><linearGradient id="Definition_LinearGradient_8_8_13_13_abefff00_39506800"><stop offset="0" style="stop-color: #abefff; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #395068; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_8_8_13_13_abefff00_39506800" x1="8.100505066" y1="8.100505066" x2="13.899494934" y2="13.899494934" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_8_8_13_13_abefff00_39506800"/><linearGradient id="Definition_LinearGradient_8_26_13_31_ff3e3e00_78151500"><stop offset="0" style="stop-color: #ff3e3e; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #781515; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_8_26_13_31_ff3e3e00_78151500" x1="8.100505066" y1="26.100505066" x2="13.899494934" y2="31.899494934" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_8_26_13_31_ff3e3e00_78151500"/><linearGradient id="Definition_LinearGradient_187_91_189_93_abefff00_39506800"><stop offset="0" style="stop-color: #abefff; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #395068; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_187_91_189_93_abefff00_39506800" x1="187.157359314" y1="91.061359314" x2="189.642640686" y2="93.546640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_187_91_189_93_abefff00_39506800"/><linearGradient id="Definition_LinearGradient_247_127_250_130_abefff00_39506800"><stop offset="0" style="stop-color: #abefff; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #395068; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_247_127_250_130_abefff00_39506800" x1="247.957359314" y1="127.781359314" x2="250.442640686" y2="130.266640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_247_127_250_130_abefff00_39506800"/><linearGradient id="Definition_LinearGradient_308_78_311_80_abefff00_39506800"><stop offset="0" style="stop-color: #abefff; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #395068; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_308_78_311_80_abefff00_39506800" x1="308.757359314" y1="78.101359314" x2="311.242640686" y2="80.586640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_308_78_311_80_abefff00_39506800"/><linearGradient id="Definition_LinearGradient_369_142_372_144_abefff00_39506800"><stop offset="0" style="stop-color: #abefff; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #395068; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_369_142_372_144_abefff00_39506800" x1="369.557359314" y1="142.037359314" x2="372.042640686" y2="144.522640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_369_142_372_144_abefff00_39506800"/><linearGradient id="Definition_LinearGradient_430_124_432_127_abefff00_39506800"><stop offset="0" style="stop-color: #abefff; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #395068; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_430_124_432_127_abefff00_39506800" x1="430.357359314" y1="124.613359314" x2="432.842640686" y2="127.098640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_430_124_432_127_abefff00_39506800"/><linearGradient id="Definition_LinearGradient_177_56_179_59_ff3e3e00_78151500"><stop offset="0" style="stop-color: #ff3e3e; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #781515; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_177_56_179_59_ff3e3e00_78151500" x1="177.157359314" y1="56.565359314" x2="179.642640686" y2="59.050640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_177_56_179_59_ff3e3e00_78151500"/><linearGradient id="Definition_LinearGradient_237_101_240_103_ff3e3e00_78151500"><stop offset="0" style="stop-color: #ff3e3e; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #781515; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_237_101_240_103_ff3e3e00_78151500" x1="237.957359314" y1="101.061359314" x2="240.442640686" y2="103.546640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_237_101_240_103_ff3e3e00_78151500"/><linearGradient id="Definition_LinearGradient_298_91_301_94_ff3e3e00_78151500"><stop offset="0" style="stop-color: #ff3e3e; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #781515; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_298_91_301_94_ff3e3e00_78151500" x1="298.757359314" y1="91.845359314" x2="301.242640686" y2="94.330640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_298_91_301_94_ff3e3e00_78151500"/><linearGradient id="Definition_LinearGradient_359_134_362_136_ff3e3e00_78151500"><stop offset="0" style="stop-color: #ff3e3e; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #781515; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_359_134_362_136_ff3e3e00_78151500" x1="359.557359314" y1="134.037359314" x2="362.042640686" y2="136.522640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_359_134_362_136_ff3e3e00_78151500"/><linearGradient id="Definition_LinearGradient_420_46_422_48_ff3e3e00_78151500"><stop offset="0" style="stop-color: #ff3e3e; stop-opacity: 1.00;"/><stop offset="1" style="stop-color: #781515; stop-opacity: 1.00;"/></linearGradient><linearGradient xmlns:xlink="http://www.w3.org/1999/xlink" id="LinearGradient_420_46_422_48_ff3e3e00_78151500" x1="420.357359314" y1="46.485359314" x2="422.842640686" y2="48.970640686" gradientUnits="userSpaceOnUse" xlink:href="#Definition_LinearGradient_420_46_422_48_ff3e3e00_78151500"/></defs><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 0.0000,200.0000 L 0.0000,0.0000 L 500.0000,0.0000 L 500.0000,200.0000 L 0.0000,200.0000 z " style="fill: #2e3436; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_1"/><path d=" M 1.0000,199.0000 L 1.0000,1.0000 L 99.0000,1.0000 L 99.0000,199.0000 L 1.0000,199.0000 z " style="fill: none; stroke: #555753; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_2"/><path d=" M 2.0000,198.0000 L 2.0000,2.0000 L 98.0000,2.0000 L 98.0000,198.0000 L 2.0000,198.0000 z " style="fill: #000000; fill-opacity: 0.00; stroke: none;" id="ezcGraphPolygon_3"/><ellipse cx="11" cy="11" rx="7" ry="7" style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_4"/><ellipse cx="11" cy="11" rx="6.3" ry="6.3" style="fill: url(#LinearGradient_8_8_13_13_abefff00_39506800); stroke: none;" id="ezcGraphCircle_5"/><ellipse cx="11" cy="29" rx="7" ry="7" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_7"/><ellipse cx="11" cy="29" rx="6.3" ry="6.3" style="fill: url(#LinearGradient_8_26_13_31_ff3e3e00_78151500); stroke: none;" id="ezcGraphCircle_8"/><path d=" M 100.0000,146.0000 L 120.0000,126.0000 L 500.0000,126.0000 L 480.0000,146.0000 L 100.0000,146.0000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_10"/><path d=" M 120.0000,126.0000 L 500.0000,126.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_11"/><path d=" M 492.0000,130.0000 L 500.0000,126.0000 L 492.0000,122.0000 L 492.0000,130.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_12"/><path d=" M 138.0000,200.0000 L 158.0000,180.0000 L 158.0000,0.0000 L 138.0000,20.0000 L 138.0000,200.0000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_13"/><path d=" M 158.0000,180.0000 L 158.0000,0.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_14"/><path d=" M 155.5000,5.0000 L 158.0000,0.0000 L 160.5000,5.0000 L 155.5000,5.0000 z " style="fill: #eeeeec; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_15"/><path d=" M 218.8000,162.0000 L 218.8000,18.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_17"/><path d=" M 198.8000,143.3000 L 218.8000,123.3000 L 218.8000,128.7000 L 198.8000,148.7000 L 198.8000,143.3000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_18"/><path d=" M 198.8000,143.3000 L 218.8000,123.3000 L 218.8000,128.7000 L 198.8000,148.7000 L 198.8000,143.3000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_19"/><path d=" M 279.6000,162.0000 L 279.6000,18.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_21"/><path d=" M 259.6000,143.3000 L 279.6000,123.3000 L 279.6000,128.7000 L 259.6000,148.7000 L 259.6000,143.3000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_22"/><path d=" M 259.6000,143.3000 L 279.6000,123.3000 L 279.6000,128.7000 L 259.6000,148.7000 L 259.6000,143.3000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_23"/><path d=" M 340.4000,162.0000 L 340.4000,18.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_25"/><path d=" M 320.4000,143.3000 L 340.4000,123.3000 L 340.4000,128.7000 L 320.4000,148.7000 L 320.4000,143.3000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_26"/><path d=" M 320.4000,143.3000 L 340.4000,123.3000 L 340.4000,128.7000 L 320.4000,148.7000 L 320.4000,143.3000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_27"/><path d=" M 401.2000,162.0000 L 401.2000,18.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_29"/><path d=" M 381.2000,143.3000 L 401.2000,123.3000 L 401.2000,128.7000 L 381.2000,148.7000 L 381.2000,143.3000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_30"/><path d=" M 381.2000,143.3000 L 401.2000,123.3000 L 401.2000,128.7000 L 381.2000,148.7000 L 381.2000,143.3000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_31"/><path d=" M 462.0000,162.0000 L 462.0000,18.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_33"/><path d=" M 442.0000,143.3000 L 462.0000,123.3000 L 462.0000,128.7000 L 442.0000,148.7000 L 442.0000,143.3000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_34"/><path d=" M 442.0000,143.3000 L 462.0000,123.3000 L 462.0000,128.7000 L 442.0000,148.7000 L 442.0000,143.3000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_35"/><path d=" M 462.0000,162.0000 L 158.0000,162.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_36"/><path d=" M 138.0000,182.0000 L 158.0000,162.0000 L 160.8500,162.0000 L 140.8500,182.0000 L 138.0000,182.0000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_37"/><path d=" M 138.0000,182.0000 L 158.0000,162.0000 L 160.8500,162.0000 L 140.8500,182.0000 L 138.0000,182.0000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_38"/><path d=" M 462.0000,90.0000 L 158.0000,90.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_41"/><path d=" M 138.0000,110.0000 L 158.0000,90.0000 L 160.8500,90.0000 L 140.8500,110.0000 L 138.0000,110.0000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_42"/><path d=" M 138.0000,110.0000 L 158.0000,90.0000 L 160.8500,90.0000 L 140.8500,110.0000 L 138.0000,110.0000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_43"/><path d=" M 462.0000,54.0000 L 158.0000,54.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_45"/><path d=" M 138.0000,74.0000 L 158.0000,54.0000 L 160.8500,54.0000 L 140.8500,74.0000 L 138.0000,74.0000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_46"/><path d=" M 138.0000,74.0000 L 158.0000,54.0000 L 160.8500,54.0000 L 140.8500,74.0000 L 138.0000,74.0000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_47"/><path d=" M 462.0000,18.0000 L 158.0000,18.0000" style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_49"/><path d=" M 138.0000,38.0000 L 158.0000,18.0000 L 160.8500,18.0000 L 140.8500,38.0000 L 138.0000,38.0000 z " style="fill: #eeeeec; fill-opacity: 0.20; stroke: none;" id="ezcGraphPolygon_50"/><path d=" M 138.0000,38.0000 L 158.0000,18.0000 L 160.8500,18.0000 L 140.8500,38.0000 L 138.0000,38.0000 z " style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_51"/><path d=" M 188.4000,92.3040 L 178.4000,102.3040 L 178.4000,102.3040 L 188.4000,92.3040 L 188.4000,92.3040 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_53"/><path d=" M 188.4000,92.3040 L 178.4000,102.3040 L 178.4000,102.3040 L 188.4000,92.3040 L 188.4000,92.3040 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_54"/><path d=" M 188.4000,92.3040 L 178.4000,102.3040 L 239.2000,139.0240 L 249.2000,129.0240 L 188.4000,92.3040 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_56"/><path d=" M 188.4000,92.3040 L 178.4000,102.3040 L 239.2000,139.0240 L 249.2000,129.0240 L 188.4000,92.3040 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_57"/><path d=" M 249.2000,129.0240 L 239.2000,139.0240 L 300.0000,89.3440 L 310.0000,79.3440 L 249.2000,129.0240 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_59"/><path d=" M 249.2000,129.0240 L 239.2000,139.0240 L 300.0000,89.3440 L 310.0000,79.3440 L 249.2000,129.0240 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_60"/><path d=" M 310.0000,79.3440 L 300.0000,89.3440 L 360.8000,153.2800 L 370.8000,143.2800 L 310.0000,79.3440 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_62"/><path d=" M 310.0000,79.3440 L 300.0000,89.3440 L 360.8000,153.2800 L 370.8000,143.2800 L 310.0000,79.3440 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_63"/><path d=" M 370.8000,143.2800 L 360.8000,153.2800 L 421.6000,135.8560 L 431.6000,125.8560 L 370.8000,143.2800 z " style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_65"/><path d=" M 370.8000,143.2800 L 360.8000,153.2800 L 421.6000,135.8560 L 431.6000,125.8560 L 370.8000,143.2800 z " style="fill: none; stroke: #395068; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_66"/><path d=" M 178.4000,57.8080 L 168.4000,67.8080 L 168.4000,67.8080 L 178.4000,57.8080 L 178.4000,57.8080 z " style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_68"/><path d=" M 178.4000,57.8080 L 168.4000,67.8080 L 168.4000,67.8080 L 178.4000,57.8080 L 178.4000,57.8080 z " style="fill: none; stroke: #781515; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_69"/><path d=" M 178.4000,57.8080 L 168.4000,67.8080 L 229.2000,112.3040 L 239.2000,102.3040 L 178.4000,57.8080 z " style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_70"/><path d=" M 178.4000,57.8080 L 168.4000,67.8080 L 229.2000,112.3040 L 239.2000,102.3040 L 178.4000,57.8080 z " style="fill: none; stroke: #781515; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_71"/><path d=" M 239.2000,102.3040 L 229.2000,112.3040 L 290.0000,103.0880 L 300.0000,93.0880 L 239.2000,102.3040 z " style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_72"/><path d=" M 239.2000,102.3040 L 229.2000,112.3040 L 290.0000,103.0880 L 300.0000,93.0880 L 239.2000,102.3040 z " style="fill: none; stroke: #781515; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_73"/><path d=" M 300.0000,93.0880 L 290.0000,103.0880 L 350.8000,145.2800 L 360.8000,135.2800 L 300.0000,93.0880 z " style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_74"/><path d=" M 300.0000,93.0880 L 290.0000,103.0880 L 350.8000,145.2800 L 360.8000,135.2800 L 300.0000,93.0880 z " style="fill: none; stroke: #781515; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_75"/><path d=" M 360.8000,135.2800 L 350.8000,145.2800 L 411.6000,57.7280 L 421.6000,47.7280 L 360.8000,135.2800 z " style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_76"/><path d=" M 360.8000,135.2800 L 350.8000,145.2800 L 411.6000,57.7280 L 421.6000,47.7280 L 360.8000,135.2800 z " style="fill: none; stroke: #781515; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_77"/><ellipse cx="188.4" cy="92.304" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_79"/><ellipse cx="188.4" cy="92.304" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_187_91_189_93_abefff00_39506800); stroke: none;" id="ezcGraphCircle_80"/><ellipse cx="249.2" cy="129.024" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_81"/><ellipse cx="249.2" cy="129.024" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_247_127_250_130_abefff00_39506800); stroke: none;" id="ezcGraphCircle_82"/><ellipse cx="310" cy="79.344" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_83"/><ellipse cx="310" cy="79.344" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_308_78_311_80_abefff00_39506800); stroke: none;" id="ezcGraphCircle_84"/><ellipse cx="370.8" cy="143.28" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_85"/><ellipse cx="370.8" cy="143.28" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_369_142_372_144_abefff00_39506800); stroke: none;" id="ezcGraphCircle_86"/><ellipse cx="431.6" cy="125.856" rx="3" ry="3" style="fill: #729fcf; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_87"/><ellipse cx="431.6" cy="125.856" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_430_124_432_127_abefff00_39506800); stroke: none;" id="ezcGraphCircle_88"/><ellipse cx="178.4" cy="57.808" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_89"/><ellipse cx="178.4" cy="57.808" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_177_56_179_59_ff3e3e00_78151500); stroke: none;" id="ezcGraphCircle_90"/><ellipse cx="239.2" cy="102.304" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_91"/><ellipse cx="239.2" cy="102.304" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_237_101_240_103_ff3e3e00_78151500); stroke: none;" id="ezcGraphCircle_92"/><ellipse cx="300" cy="93.088" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_93"/><ellipse cx="300" cy="93.088" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_298_91_301_94_ff3e3e00_78151500); stroke: none;" id="ezcGraphCircle_94"/><ellipse cx="360.8" cy="135.28" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_95"/><ellipse cx="360.8" cy="135.28" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_359_134_362_136_ff3e3e00_78151500); stroke: none;" id="ezcGraphCircle_96"/><ellipse cx="421.6" cy="47.728" rx="3" ry="3" style="fill: #ef2929; fill-opacity: 1.00; stroke: none;" id="ezcGraphCircle_97"/><ellipse cx="421.6" cy="47.728" rx="2.7" ry="2.7" style="fill: url(#LinearGradient_420_46_422_48_ff3e3e00_78151500); stroke: none;" id="ezcGraphCircle_98"/><path d=" M 500.0000,126.0000 L 480.0000,146.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_99"/><path d=" M 480.0000,146.0000 L 100.0000,146.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_100"/><path d=" M 100.0000,146.0000 L 120.0000,126.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_101"/><path d=" M 158.0000,0.0000 L 138.0000,20.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_102"/><path d=" M 138.0000,20.0000 L 138.0000,200.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_103"/><path d=" M 138.0000,200.0000 L 158.0000,180.0000" style="fill: none; stroke: #eeeeec; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphLine_104"/><text id="ezcGraphTextBox_6" x="19" text-length="46.2px" y="18" style="font-size: 14px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">Line 1</text><text id="ezcGraphTextBox_9" x="19" text-length="46.2px" y="36" style="font-size: 14px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">Line 2</text><text id="ezcGraphTextBox_16" x="141.12" text-length="54.56px" y="160.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 1</text><text id="ezcGraphTextBox_20" x="201.92" text-length="54.56px" y="160.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 2</text><text id="ezcGraphTextBox_24" x="262.72" text-length="54.56px" y="160.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 3</text><text id="ezcGraphTextBox_28" x="323.52" text-length="54.56px" y="160.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 4</text><text id="ezcGraphTextBox_32" x="384.32" text-length="54.56px" y="160.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">sample 5</text><text id="ezcGraphTextBox_39" x="108.82" text-length="27.28px" y="180.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">-250</text><text id="ezcGraphTextBox_40" x="129.28" text-length="6.82px" y="144.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">0</text><text id="ezcGraphTextBox_44" x="115.64" text-length="20.46px" y="108.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">250</text><text id="ezcGraphTextBox_48" x="115.64" text-length="20.46px" y="72.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">500</text><text id="ezcGraphTextBox_52" x="115.64" text-length="20.46px" y="52.2" style="font-size: 12px; font-family: sans-serif; fill: #d3d7cf; fill-opacity: 1.00; stroke: none;">750</text><path d=" M 179.6500,88.1040 L 179.6500,76.6040 L 197.6500,76.6040 L 197.6500,88.1040 L 179.6500,88.1040 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_105"/><path d=" M 179.6500,88.1040 L 179.6500,76.6040 L 197.6500,76.6040 L 197.6500,88.1040 L 179.6500,88.1040 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_106"/><text id="ezcGraphTextBox_55" x="180.15" text-length="16.5px" y="87.104" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">234</text><path d=" M 240.4500,146.4240 L 240.4500,134.9240 L 258.4500,134.9240 L 258.4500,146.4240 L 240.4500,146.4240 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_107"/><path d=" M 240.4500,146.4240 L 240.4500,134.9240 L 258.4500,134.9240 L 258.4500,146.4240 L 240.4500,146.4240 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_108"/><text id="ezcGraphTextBox_58" x="240.95" text-length="16.5px" y="145.424" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">-21</text><path d=" M 301.2500,75.1440 L 301.2500,63.6440 L 319.2500,63.6440 L 319.2500,75.1440 L 301.2500,75.1440 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_109"/><path d=" M 301.2500,75.1440 L 301.2500,63.6440 L 319.2500,63.6440 L 319.2500,75.1440 L 301.2500,75.1440 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_110"/><text id="ezcGraphTextBox_61" x="301.75" text-length="16.5px" y="74.144" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">324</text><path d=" M 359.3000,160.6800 L 359.3000,149.1800 L 382.8000,149.1800 L 382.8000,160.6800 L 359.3000,160.6800 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_111"/><path d=" M 359.3000,160.6800 L 359.3000,149.1800 L 382.8000,149.1800 L 382.8000,160.6800 L 359.3000,160.6800 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_112"/><text id="ezcGraphTextBox_64" x="359.8" text-length="22px" y="159.68" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">-120</text><path d=" M 428.3500,121.6560 L 428.3500,110.1560 L 435.3500,110.1560 L 435.3500,121.6560 L 428.3500,121.6560 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_113"/><path d=" M 428.3500,121.6560 L 428.3500,110.1560 L 435.3500,110.1560 L 435.3500,121.6560 L 428.3500,121.6560 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_114"/><text id="ezcGraphTextBox_67" x="428.85" text-length="5.5px" y="120.656" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">1</text><path d=" M 412.8500,43.5280 L 412.8500,32.0280 L 430.8500,32.0280 L 430.8500,43.5280 L 412.8500,43.5280 z " style="fill: #d3d7cf; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_115"/><path d=" M 412.8500,43.5280 L 412.8500,32.0280 L 430.8500,32.0280 L 430.8500,43.5280 L 412.8500,43.5280 z " style="fill: none; stroke: #888a85; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_116"/><text id="ezcGraphTextBox_78" x="413.35" text-length="16.5px" y="42.528" style="font-size: 10px; font-family: sans-serif; fill: #3465a4; fill-opacity: 1.00; stroke: none;">613</text></g></svg> diff --git a/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithBackground.svg b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithBackground.svg new file mode 100644 index 0000000..05d55f4 --- /dev/null +++ b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithBackground.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 9.5000,81.0000 L 9.5000,9.5000 L 161.0000,9.5000 L 161.0000,81.0000 L 9.5000,81.0000 z " style="fill: #dddddd; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_2"/><text id="ezcGraphTextBox_1" x="10" text-length="149.6px" y="53.5" style="font-size: 17px; font-family: sans-serif; fill: #000000; fill-opacity: 1.00; stroke: none;">Some test string</text></g></svg> diff --git a/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithBorder.svg b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithBorder.svg new file mode 100644 index 0000000..2f19f01 --- /dev/null +++ b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithBorder.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 10.5000,80.0000 L 10.5000,10.5000 L 160.0000,10.5000 L 160.0000,80.0000 L 10.5000,80.0000 z " style="fill: none; stroke: #555555; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_2"/><text id="ezcGraphTextBox_1" x="11" text-length="140.8px" y="53" style="font-size: 16px; font-family: sans-serif; fill: #000000; fill-opacity: 1.00; stroke: none;">Some test string</text></g></svg> diff --git a/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundBottomRight.svg b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundBottomRight.svg new file mode 100644 index 0000000..f5aeb63 --- /dev/null +++ b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundBottomRight.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 13.7000,82.0000 L 13.7000,58.5000 L 162.0000,58.5000 L 162.0000,82.0000 L 13.7000,82.0000 z " style="fill: #dddddd; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_2"/><path d=" M 13.7000,82.0000 L 13.7000,58.5000 L 162.0000,58.5000 L 162.0000,82.0000 L 13.7000,82.0000 z " style="fill: none; stroke: #555555; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_3"/><text id="ezcGraphTextBox_1" x="16.2" text-length="140.8px" y="77" style="font-size: 16px; font-family: sans-serif; fill: #000000; fill-opacity: 1.00; stroke: none;">Some test string</text></g></svg> diff --git a/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter.svg b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter.svg new file mode 100644 index 0000000..d14c9ec --- /dev/null +++ b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 12.1000,58.0000 L 12.1000,34.5000 L 160.4000,34.5000 L 160.4000,58.0000 L 12.1000,58.0000 z " style="fill: #dddddd; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_2"/><path d=" M 12.1000,58.0000 L 12.1000,34.5000 L 160.4000,34.5000 L 160.4000,58.0000 L 12.1000,58.0000 z " style="fill: none; stroke: #555555; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_3"/><text id="ezcGraphTextBox_1" x="14.6" text-length="140.8px" y="53" style="font-size: 16px; font-family: sans-serif; fill: #000000; fill-opacity: 1.00; stroke: none;">Some test string</text></g></svg> diff --git a/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundTopLeft.svg b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundTopLeft.svg new file mode 100644 index 0000000..9d36eda --- /dev/null +++ b/tests/data/compare/ezcGraphSvgDriverTest_testDrawTextWithMinimizedBorderAndBackgroundTopLeft.svg @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<svg xmlns="http://www.w3.org/2000/svg" width="200" height="100" version="1.0" id="ezcGraph"><defs/><g id="ezcGraphChart" color-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="optimizeLegibility"><path d=" M 10.5000,34.0000 L 10.5000,10.5000 L 158.8000,10.5000 L 158.8000,34.0000 L 10.5000,34.0000 z " style="fill: #dddddd; fill-opacity: 1.00; stroke: none;" id="ezcGraphPolygon_2"/><path d=" M 10.5000,34.0000 L 10.5000,10.5000 L 158.8000,10.5000 L 158.8000,34.0000 L 10.5000,34.0000 z " style="fill: none; stroke: #555555; stroke-width: 1; stroke-opacity: 1.00; stroke-linecap: round; stroke-linejoin: round;" id="ezcGraphPolygon_3"/><text id="ezcGraphTextBox_1" x="13" text-length="140.8px" y="29" style="font-size: 16px; font-family: sans-serif; fill: #000000; fill-opacity: 1.00; stroke: none;">Some test string</text></g></svg> diff --git a/tests/driver_gd_test.php b/tests/driver_gd_test.php index 45c0382..ee87bc8 100644 --- a/tests/driver_gd_test.php +++ b/tests/driver_gd_test.php @@ -1594,6 +1594,162 @@ class ezcGraphGdDriverTest extends ezcImageTestCase $this->fail( 'Expected ezcGraphFontRenderingException.' ); } + + public function testDrawTextWithBackground() + { + $filename = $this->tempDir . __FUNCTION__ . '.png'; + + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = false; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::LEFT | ezcGraph::MIDDLE + ); + + $this->driver->render( $filename ); + + $this->assertTrue( + file_exists( $filename ), + 'No image was generated.' + ); + + $this->assertImageSimilar( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', + 'Image does not look as expected.', + 2000 + ); + } + + public function testDrawTextWithBorder() + { + $filename = $this->tempDir . __FUNCTION__ . '.png'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->minimizeBorder = false; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::LEFT | ezcGraph::MIDDLE + ); + + $this->driver->render( $filename ); + + $this->assertTrue( + file_exists( $filename ), + 'No image was generated.' + ); + + $this->assertImageSimilar( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', + 'Image does not look as expected.', + 2000 + ); + } + + public function testDrawTextWithMinimizedBorderAndBackgroundTopLeft() + { + $filename = $this->tempDir . __FUNCTION__ . '.png'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = true; + $this->driver->options->font->padding = 2; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::LEFT | ezcGraph::TOP + ); + + $this->driver->render( $filename ); + + $this->assertTrue( + file_exists( $filename ), + 'No image was generated.' + ); + + $this->assertImageSimilar( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', + 'Image does not look as expected.', + 2000 + ); + } + + public function testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter() + { + $filename = $this->tempDir . __FUNCTION__ . '.png'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = true; + $this->driver->options->font->padding = 2; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::CENTER | ezcGraph::MIDDLE + ); + + $this->driver->render( $filename ); + + $this->assertTrue( + file_exists( $filename ), + 'No image was generated.' + ); + + $this->assertImageSimilar( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', + 'Image does not look as expected.', + 2000 + ); + } + + public function testDrawTextWithMinimizedBorderAndBackgroundBottomRight() + { + $filename = $this->tempDir . __FUNCTION__ . '.png'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = true; + $this->driver->options->font->padding = 2; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::RIGHT | ezcGraph::BOTTOM + ); + + $this->driver->render( $filename ); + + $this->assertTrue( + file_exists( $filename ), + 'No image was generated.' + ); + + $this->assertImageSimilar( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png', + 'Image does not look as expected.', + 2000 + ); + } } ?> diff --git a/tests/driver_svg_test.php b/tests/driver_svg_test.php index cd64e49..b23c405 100644 --- a/tests/driver_svg_test.php +++ b/tests/driver_svg_test.php @@ -25,7 +25,7 @@ class ezcGraphSvgDriverTest extends ezcTestCase protected $testFiles = array( 'jpeg' => 'jpeg.jpg', - 'png' => 'png.png', + 'svg' => 'png.png', ); public static function suite() @@ -433,7 +433,7 @@ class ezcGraphSvgDriverTest extends ezcTestCase $filename = $this->tempDir . __FUNCTION__ . '.svg'; $this->driver->drawImage( - $this->basePath . $this->testFiles['png'], + $this->basePath . $this->testFiles['svg'], new ezcGraphCoordinate( 10, 10 ), 100, 50 @@ -949,6 +949,127 @@ class ezcGraphSvgDriverTest extends ezcTestCase $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' ); } + + public function testDrawTextWithBackground() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = false; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::LEFT | ezcGraph::MIDDLE + ); + + $this->driver->render( $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } + + public function testDrawTextWithBorder() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->minimizeBorder = false; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::LEFT | ezcGraph::MIDDLE + ); + + $this->driver->render( $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } + + public function testDrawTextWithMinimizedBorderAndBackgroundTopLeft() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = true; + $this->driver->options->font->padding = 2; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::LEFT | ezcGraph::TOP + ); + + $this->driver->render( $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } + + public function testDrawTextWithMinimizedBorderAndBackgroundMiddleCenter() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = true; + $this->driver->options->font->padding = 2; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::CENTER | ezcGraph::MIDDLE + ); + + $this->driver->render( $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } + + public function testDrawTextWithMinimizedBorderAndBackgroundBottomRight() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $this->driver->options->font->border = ezcGraphColor::fromHex( '#555555' ); + $this->driver->options->font->background = ezcGraphColor::fromHex( '#DDDDDD' ); + $this->driver->options->font->minimizeBorder = true; + $this->driver->options->font->padding = 2; + + $this->driver->drawTextBox( + 'Some test string', + new ezcGraphCoordinate( 10, 10 ), + 150, + 70, + ezcGraph::RIGHT | ezcGraph::BOTTOM + ); + + $this->driver->render( $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } } ?> diff --git a/tests/pie_test.php b/tests/pie_test.php index b7b1c14..c3d5883 100644 --- a/tests/pie_test.php +++ b/tests/pie_test.php @@ -213,8 +213,8 @@ class ezcGraphPieChartTest extends ezcImageTestCase $chart->data['Skien'] = new ezcGraphArrayDataSet( array( 'Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1 ) ); $chart->data['Skien']->highlight['Norwegian'] = true; - $chart->renderer->options->pieVerticalSize = .1; - $chart->renderer->options->pieHorizontalSize = .1; + $chart->renderer->options->pieVerticalSize = .2; + $chart->renderer->options->pieHorizontalSize = .2; $chart->render( 500, 200, $filename ); diff --git a/tests/renderer_2d_test.php b/tests/renderer_2d_test.php index 6e92989..6acc6e2 100644 --- a/tests/renderer_2d_test.php +++ b/tests/renderer_2d_test.php @@ -1859,6 +1859,36 @@ class ezcGraphRenderer2dTest extends ezcTestCase $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' ); } + + public function testRenderLineChartWithHighlightedData() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $chart = new ezcGraphLineChart(); + $chart->palette = new ezcGraphPaletteBlack(); + + $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); + + $chart->data['Line 1']->highlight = true; + $chart->data['Line 2']->highlight['sample 5'] = true; + + $chart->data['Line 1']->displayType = ezcGraph::BAR; + + $chart->options->highlightSize = 12; + $chart->options->highlightFont->color = ezcGraphColor::fromHex( '#3465A4' ); + $chart->options->highlightFont->background = ezcGraphColor::fromHex( '#D3D7CF' ); + $chart->options->highlightFont->border = ezcGraphColor::fromHex( '#888A85' ); + + $chart->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer(); + + $chart->render( 500, 200, $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } } ?> diff --git a/tests/renderer_3d_test.php b/tests/renderer_3d_test.php index a851e03..3204b0c 100644 --- a/tests/renderer_3d_test.php +++ b/tests/renderer_3d_test.php @@ -1079,6 +1079,38 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' ); } + + public function testRenderLineChartWithHighlightedData() + { + $filename = $this->tempDir . __FUNCTION__ . '.svg'; + + $chart = new ezcGraphLineChart(); + $chart->palette = new ezcGraphPaletteBlack(); + + $chart->data['Line 1'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => -21, 'sample 3' => 324, 'sample 4' => -120, 'sample 5' => 1) ); + $chart->data['Line 2'] = new ezcGraphArrayDataSet( array( 'sample 1' => 543, 'sample 2' => 234, 'sample 3' => 298, 'sample 4' => 5, 'sample 5' => 613) ); + + $chart->data['Line 1']->highlight = true; + $chart->data['Line 2']->highlight['sample 5'] = true; + + $chart->options->highlightSize = 12; + $chart->options->highlightFont->color = ezcGraphColor::fromHex( '#3465A4' ); + $chart->options->highlightFont->background = ezcGraphColor::fromHex( '#D3D7CF' ); + $chart->options->highlightFont->border = ezcGraphColor::fromHex( '#888A85' ); + + $chart->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer(); + + $chart->renderer = new ezcGraphRenderer3d(); + $chart->renderer->options->barChartGleam = .5; + $chart->renderer->options->legendSymbolGleam = .5; + + $chart->render( 500, 200, $filename ); + + $this->compare( + $filename, + $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg' + ); + } } ?> |