summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-08-15 15:00:03 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-08-15 15:00:03 +0000
commit440bcae05b756a4167df690a48b2b77817d6a39a (patch)
tree2330ddda037e2efbaeda8d147164937f2581096a
parent4c85aee953e34bb0f997af13fc9b35e5ed29699c (diff)
downloadzetacomponents-graph-440bcae05b756a4167df690a48b2b77817d6a39a.zip
zetacomponents-graph-440bcae05b756a4167df690a48b2b77817d6a39a.tar.gz
- Use symbol as bottom shape for bars in 3d renderer
-rw-r--r--src/charts/line.php1
-rw-r--r--src/interfaces/renderer.php2
-rw-r--r--src/renderer/2d.php2
-rw-r--r--src/renderer/3d.php282
-rw-r--r--tests/data/compare/ezcGraphRenderer3dTest_testRenderBarChartSymbols.pngbin0 -> 118204 bytes
-rw-r--r--tests/data/compare/ezcGraphRenderer3dTest_testRenderNegativeBarChartSymbols.pngbin0 -> 120783 bytes
-rw-r--r--tests/renderer_3d_test.php72
7 files changed, 282 insertions, 77 deletions
diff --git a/src/charts/line.php b/src/charts/line.php
index 02323e9..60b2e4b 100644
--- a/src/charts/line.php
+++ b/src/charts/line.php
@@ -174,6 +174,7 @@ class ezcGraphLineChart extends ezcGraphChart
$width,
$nr[$data->displayType->default],
$count[$data->displayType->default],
+ $data->symbol[$key],
$yAxisNullPosition
);
}
diff --git a/src/interfaces/renderer.php b/src/interfaces/renderer.php
index 2549f00..9d6b850 100644
--- a/src/interfaces/renderer.php
+++ b/src/interfaces/renderer.php
@@ -57,6 +57,7 @@ abstract class ezcGraphRenderer
* @param float $stepSize Space which can be used for bars
* @param int $dataNumber Number of dataset
* @param int $dataCount Count of datasets in chart
+ * @param int $symbol Symbol to draw for line
* @param float $axisPosition Position of axis for drawing filled lines
* @return void
*/
@@ -67,6 +68,7 @@ abstract class ezcGraphRenderer
$stepSize,
$dataNumber = 1,
$dataCount = 1,
+ $symbol = ezcGraph::NO_SYMBOL,
$axisPosition = 0.
);
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
index ed3ebff..86a0472 100644
--- a/src/renderer/2d.php
+++ b/src/renderer/2d.php
@@ -274,6 +274,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer
* @param float $stepSize Space which can be used for bars
* @param int $dataNumber Number of dataset
* @param int $dataCount Count of datasets in chart
+ * @param int $symbol Symbol to draw for line
* @param float $axisPosition Position of axis for drawing filled lines
* @return void
*/
@@ -284,6 +285,7 @@ class ezcGraphRenderer2d extends ezcGraphRenderer
$stepSize,
$dataNumber = 1,
$dataCount = 1,
+ $symbol = ezcGraph::NO_SYMBOL,
$axisPosition = 0. )
{
// Apply margin
diff --git a/src/renderer/3d.php b/src/renderer/3d.php
index 2af00c3..74519dc 100644
--- a/src/renderer/3d.php
+++ b/src/renderer/3d.php
@@ -445,6 +445,7 @@ class ezcGraphRenderer3d extends ezcGraphRenderer
* @param float $stepSize Space which can be used for bars
* @param int $dataNumber Number of dataset
* @param int $dataCount Count of datasets in chart
+ * @param int $symbol Symbol to draw for line
* @param float $axisPosition Position of axis for drawing filled lines
* @return void
*/
@@ -455,6 +456,7 @@ class ezcGraphRenderer3d extends ezcGraphRenderer
$stepSize,
$dataNumber = 1,
$dataCount = 1,
+ $symbol = ezcGraph::NO_SYMBOL,
$axisPosition = 0. )
{
// Apply margin
@@ -464,98 +466,224 @@ class ezcGraphRenderer3d extends ezcGraphRenderer
$offset = - $stepSize / 2 + $margin / 2 + ( $dataCount - $dataNumber - 1 ) * ( $padding + $barWidth ) + $padding / 2;
$startDepth = $this->options->barMargin;
+ $midDepth = .5;
$endDepth = 1 - $this->options->barMargin;
- $barPolygonArray = array(
- new ezcGraphCoordinate(
- $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset,
- $this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
- ),
- new ezcGraphCoordinate(
- $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset,
- $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
- ),
- new ezcGraphCoordinate(
- $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth,
- $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
- ),
- new ezcGraphCoordinate(
- $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth,
- $this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
- ),
- );
+ switch ( $symbol )
+ {
+ case ezcGraph::NO_SYMBOL:
+ $barPolygonArray = array(
+ new ezcGraphCoordinate(
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset,
+ $this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
+ ),
+ new ezcGraphCoordinate(
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset,
+ $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
+ ),
+ new ezcGraphCoordinate(
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth,
+ $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
+ ),
+ new ezcGraphCoordinate(
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth,
+ $this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
+ ),
+ );
- // Draw right bar side
- $this->barPostProcessing[] = array(
- 'polygone' => array(
- $this->get3dCoordinate( $barPolygonArray[2], $startDepth ),
- $this->get3dCoordinate( $barPolygonArray[3], $startDepth ),
- $this->get3dCoordinate( $barPolygonArray[3], $endDepth ),
- $this->get3dCoordinate( $barPolygonArray[2], $endDepth ),
- ),
- 'color' => $color->darken( $this->options->barDarkenSide ),
- );
+ // Draw right bar side
+ $this->barPostProcessing[] = array(
+ 'index' => $barPolygonArray[2]->x,
+ 'method' => 'drawPolygon',
+ 'parameters' => array(
+ array(
+ $this->get3dCoordinate( $barPolygonArray[2], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[3], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[3], $endDepth ),
+ $this->get3dCoordinate( $barPolygonArray[2], $endDepth ),
+ ),
+ $color->darken( $this->options->barDarkenSide ),
+ true
+ ),
+ );
- // Draw bar top
- $this->barPostProcessing[] = array(
- 'polygone' => array(
- $this->get3dCoordinate( $barPolygonArray[1], $startDepth ),
- $this->get3dCoordinate( $barPolygonArray[2], $startDepth ),
- $this->get3dCoordinate( $barPolygonArray[2], $endDepth ),
- $this->get3dCoordinate( $barPolygonArray[1], $endDepth ),
- ),
- 'color' => $color->darken( $this->options->barDarkenTop ),
- );
+ $this->barPostProcessing[] = array(
+ 'index' => $barPolygonArray[1]->x,
+ 'method' => 'drawPolygon',
+ 'parameters' => array(
+ ( $barPolygonArray[1]->y < $barPolygonArray[3]->y
+ ? array(
+ $this->get3dCoordinate( $barPolygonArray[1], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[2], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[2], $endDepth ),
+ $this->get3dCoordinate( $barPolygonArray[1], $endDepth ),
+ )
+ : array(
+ $this->get3dCoordinate( $barPolygonArray[0], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[3], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[3], $endDepth ),
+ $this->get3dCoordinate( $barPolygonArray[0], $endDepth ),
+ )
+ ),
+ $color->darken( $this->options->barDarkenTop ),
+ true
+ ),
+ );
+
+ $this->barPostProcessing[] = array(
+ 'index' => $barPolygonArray[1]->x,
+ 'method' => 'drawPolygon',
+ 'parameters' => array(
+ array(
+ $this->get3dCoordinate( $barPolygonArray[0], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[1], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[2], $startDepth ),
+ $this->get3dCoordinate( $barPolygonArray[3], $startDepth ),
+ ),
+ $color,
+ true
+ ),
+ );
+ break;
+ case ezcGraph::DIAMOND:
+ $barCoordinateArray = array(
+ // The bottom point of the diamond is moved to .7 instead
+ // of .5 because it looks more correct, even it is wrong...
+ 'x' => array(
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset,
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth * .7,
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth,
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth * .3,
+ ),
+ 'y' => array(
+ $this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) ),
+ $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) ),
+ ),
+ );
+
+ $this->barPostProcessing[] = array(
+ 'index' => $barCoordinateArray['x'][0],
+ 'method' => 'drawPolygon',
+ 'parameters' => array(
+ array(
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][0], $barCoordinateArray['y'][0] ), $midDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][0], $barCoordinateArray['y'][1] ), $midDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][1], $barCoordinateArray['y'][1] ), $startDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][1], $barCoordinateArray['y'][0] ), $startDepth ),
+ ),
+ $color,
+ true
+ ),
+ );
+
+ $this->barPostProcessing[] = array(
+ 'index' => $barCoordinateArray['x'][1],
+ 'method' => 'drawPolygon',
+ 'parameters' => array(
+ array(
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][2], $barCoordinateArray['y'][0] ), $midDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][2], $barCoordinateArray['y'][1] ), $midDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][1], $barCoordinateArray['y'][1] ), $startDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][1], $barCoordinateArray['y'][0] ), $startDepth ),
+ ),
+ $color->darken( $this->options->barDarkenSide ),
+ true
+ ),
+ );
+
+ $topLocation = min(
+ $barCoordinateArray['y'][0],
+ $barCoordinateArray['y'][1]
+ );
+
+ $this->barPostProcessing[] = array(
+ 'index' => $barCoordinateArray['x'][0],
+ 'method' => 'drawPolygon',
+ 'parameters' => array(
+ array(
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][1], $topLocation ), $startDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][2], $topLocation ), $midDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][3], $topLocation ), $endDepth ),
+ $this->get3dCoordinate( new ezcGraphCoordinate( $barCoordinateArray['x'][0], $topLocation ), $midDepth ),
+ ),
+ $color->darken( $this->options->barDarkenTop ),
+ true
+ ),
+ );
+ break;
+ case ezcGraph::BULLET:
+ case ezcGraph::CIRCLE:
+ $barCenterTop = new ezcGraphCoordinate(
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth / 2,
+ $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
+
+ );
+ $barCenterBottom = new ezcGraphCoordinate(
+ $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ( $this->dataBoundings->x1 - ( $this->dataBoundings->x0 + 2 * $this->xAxisSpace ) ) + $offset + $barWidth / 2,
+ $this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ( $this->dataBoundings->y1 - ( $this->dataBoundings->y0 + 2 * $this->yAxisSpace ) )
+ );
+
+ if ( $barCenterTop->y > $barCenterBottom->y )
+ {
+ $tmp = $barCenterTop;
+ $barCenterTop = $barCenterBottom;
+ $barCenterBottom = $tmp;
+ }
+
+ $this->barPostProcessing[] = array(
+ 'index' => $barCenterBottom->x,
+ 'method' => 'drawCircularArc',
+ 'parameters' => array(
+ $this->get3dCoordinate( $barCenterBottom, $midDepth ),
+ $barWidth,
+ $barWidth / 2,
+ ( $barCenterTop->y - $barCenterBottom->y ) * $this->yDepthFactor,
+ 0,
+ 360,
+ $color
+ ),
+ );
+
+ $this->barPostProcessing[] = array(
+ 'index' => $barCenterBottom->x + 1,
+ 'method' => 'drawCircle',
+ 'parameters' => array(
+ $this->get3dCoordinate( $barCenterTop, $midDepth ),
+ $barWidth,
+ $barWidth / 2,
+ ( $symbol === ezcGraph::CIRCLE ? $color->darken( $this->options->barDarkenTop ) : $color )
+ ),
+ );
+
+ break;
+ }
- // Draw front side
- $this->barPostProcessing[] = array(
- 'polygone' => array(
- $this->get3dCoordinate( $barPolygonArray[0], $startDepth ),
- $this->get3dCoordinate( $barPolygonArray[1], $startDepth ),
- $this->get3dCoordinate( $barPolygonArray[2], $startDepth ),
- $this->get3dCoordinate( $barPolygonArray[3], $startDepth ),
- ),
- 'color' => $color,
- );
}
protected function finishBars()
{
- $zBuffer = array();
-
- foreach ( $this->barPostProcessing as $bar )
+ if ( !count( $this->barPostProcessing ) )
{
- $zIndex = (int) ( $bar['polygone'][0]->x * 10 );
- if ( !isset( $zBuffer[$zIndex] ) )
- {
- $zBuffer[$zIndex] = array();
- }
+ return true;
+ }
- $zBuffer[$zIndex][] = $bar;
+ $zIndexArray = array();
+ foreach ( $this->barPostProcessing as $key => $barPolygon )
+ {
+ $zIndexArray[$key] = $barPolygon['index'];
}
- ksort( $zBuffer );
+ array_multisort(
+ $zIndexArray, SORT_ASC, SORT_NUMERIC,
+ $this->barPostProcessing
+ );
- foreach ( $zBuffer as $bars )
+ foreach ( $this->barPostProcessing as $bar )
{
- foreach ( $bars as $bar )
- {
- $this->driver->drawPolygon(
- $bar['polygone'],
- $bar['color'],
- true
- );
-
- if ( $this->options->dataBorder > 0 )
- {
- $borderColor = $bar['color']->darken( $this->options->dataBorder );
- $this->driver->drawPolygon(
- $bar['polygone'],
- $borderColor,
- false
- );
- }
- }
+ call_user_func_array(
+ array( $this->driver, $bar['method'] ),
+ $bar['parameters']
+ );
}
}
diff --git a/tests/data/compare/ezcGraphRenderer3dTest_testRenderBarChartSymbols.png b/tests/data/compare/ezcGraphRenderer3dTest_testRenderBarChartSymbols.png
new file mode 100644
index 0000000..b78fe71
--- /dev/null
+++ b/tests/data/compare/ezcGraphRenderer3dTest_testRenderBarChartSymbols.png
Binary files differ
diff --git a/tests/data/compare/ezcGraphRenderer3dTest_testRenderNegativeBarChartSymbols.png b/tests/data/compare/ezcGraphRenderer3dTest_testRenderNegativeBarChartSymbols.png
new file mode 100644
index 0000000..9b8c284
--- /dev/null
+++ b/tests/data/compare/ezcGraphRenderer3dTest_testRenderNegativeBarChartSymbols.png
Binary files differ
diff --git a/tests/renderer_3d_test.php b/tests/renderer_3d_test.php
index 7491169..c47faef 100644
--- a/tests/renderer_3d_test.php
+++ b/tests/renderer_3d_test.php
@@ -571,8 +571,10 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
$chart->data['Line 0'] = new ezcGraphArrayDataSet( array( 'sample 1' => 432, 'sample 2' => 43, 'sample 3' => 65, 'sample 4' => 97, 'sample 5' => 154) );
$chart->data['Line 0']->displayType = ezcGraph::BAR;
+ $chart->data['Line 0']->symbol = ezcGraph::NO_SYMBOL;
$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 1']->displayType = ezcGraph::BAR;
+ $chart->data['Line 1']->symbol = ezcGraph::NO_SYMBOL;
$chart->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer();
@@ -589,6 +591,76 @@ class ezcGraphRenderer3dTest extends ezcImageTestCase
);
}
+ public function testRenderBarChartSymbols()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $chart = new ezcGraphLineChart();
+ $chart->palette = new ezcGraphPaletteBlack();
+
+ $chart->data['Rectangle'] = new ezcGraphArrayDataSet( array( 'sample 1' => 432, 'sample 2' => 43, 'sample 3' => 65, 'sample 4' => 97, 'sample 5' => 154) );
+ $chart->data['Rectangle']->displayType = ezcGraph::BAR;
+ $chart->data['Rectangle']->symbol = ezcGraph::NO_SYMBOL;
+ $chart->data['Circle'] = new ezcGraphArrayDataSet( array( 'sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1) );
+ $chart->data['Circle']->displayType = ezcGraph::BAR;
+ $chart->data['Circle']->symbol = ezcGraph::CIRCLE;
+ $chart->data['Bullet'] = new ezcGraphArrayDataSet( array( 'sample 1' => 124, 'sample 2' => 245, 'sample 3' => 361, 'sample 4' => 412, 'sample 5' => 480) );
+ $chart->data['Bullet']->displayType = ezcGraph::BAR;
+ $chart->data['Bullet']->symbol = ezcGraph::BULLET;
+ $chart->data['Diamond'] = new ezcGraphArrayDataSet( array( 'sample 1' => 387, 'sample 2' => 261, 'sample 3' => 24, 'sample 4' => 59, 'sample 5' => 112) );
+ $chart->data['Diamond']->displayType = ezcGraph::BAR;
+ $chart->data['Diamond']->symbol = ezcGraph::DIAMOND;
+
+ $chart->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer();
+
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->renderer = new ezcGraphRenderer3d();
+ $chart->options->font = $this->basePath . 'font.ttf';
+ $chart->render( 700, 200, $filename );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
+ );
+ }
+
+ public function testRenderNegativeBarChartSymbols()
+ {
+ $filename = $this->tempDir . __FUNCTION__ . '.png';
+
+ $chart = new ezcGraphLineChart();
+ $chart->palette = new ezcGraphPaletteBlack();
+
+ $chart->data['Rectangle'] = new ezcGraphArrayDataSet( array( 'sample -1' => -432, 'sample -2' => -43, 'sample -3' => -65, 'sample -4' => -97, 'sample -5' => -154) );
+ $chart->data['Rectangle']->displayType = ezcGraph::BAR;
+ $chart->data['Rectangle']->symbol = ezcGraph::NO_SYMBOL;
+ $chart->data['Circle'] = new ezcGraphArrayDataSet( array( 'sample -1' => -234, 'sample -2' => -21, 'sample -3' => -324, 'sample -4' => -120, 'sample -5' => -1) );
+ $chart->data['Circle']->displayType = ezcGraph::BAR;
+ $chart->data['Circle']->symbol = ezcGraph::CIRCLE;
+ $chart->data['Bullet'] = new ezcGraphArrayDataSet( array( 'sample -1' => -124, 'sample -2' => -245, 'sample -3' => -361, 'sample -4' => -412, 'sample -5' => -480) );
+ $chart->data['Bullet']->displayType = ezcGraph::BAR;
+ $chart->data['Bullet']->symbol = ezcGraph::BULLET;
+ $chart->data['Diamond'] = new ezcGraphArrayDataSet( array( 'sample -1' => -387, 'sample -2' => -261, 'sample -3' => -24, 'sample -4' => -59, 'sample -5' => -112) );
+ $chart->data['Diamond']->displayType = ezcGraph::BAR;
+ $chart->data['Diamond']->symbol = ezcGraph::DIAMOND;
+
+ $chart->xAxis->axisLabelRenderer = new ezcGraphAxisBoxedLabelRenderer();
+
+ $chart->driver = new ezcGraphGdDriver();
+ $chart->renderer = new ezcGraphRenderer3d();
+ $chart->options->font = $this->basePath . 'font.ttf';
+ $chart->render( 700, 200, $filename );
+
+ $this->assertImageSimilar(
+ $filename,
+ $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.png',
+ 'Image does not look as expected.',
+ 2000
+ );
+ }
+
public function testRender3dLineChart()
{
$filename = $this->tempDir . __FUNCTION__ . '.png';
OpenPOWER on IntegriCloud