#014146: Add new data symbol - square

Description:
By default, using "none symbol" in line graphs, the legend shows a square, but there are no square symbol itself. I have added it, just copying into the Graph/interfaces/renderer.php file the same as in "no symbol", in the public function drawSymbol(
)

 case ezcGraph::SQUARE:
                $return = $this->driver->drawPolygon(
                    array(
                        new ezcGraphCoordinate( $boundings->x0, $boundings->y0 ),
                        new ezcGraphCoordinate( $boundings->x1, $boundings->y0 ),
                        new ezcGraphCoordinate( $boundings->x1, $boundings->y1 ),
                        new ezcGraphCoordinate( $boundings->x0, $boundings->y1 ),

                    ),
                    $color,
                    true
                );

                // Draw optional gleam
                if ( $this->options->legendSymbolGleam !== false )
                {
                    $this->driver->drawPolygon(
                        array(
                            $topLeft = new ezcGraphCoordinate(
                                $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $this->options->legendSymbolGleamSize,
                                $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $this->options->legendSymbolGleamSize
                            ),
                            new ezcGraphCoordinate(
                                $boundings->x1 - ( $boundings->x1 - $boundings->x0 ) * $this->options->legendSymbolGleamSize,
                                $boundings->y0 + ( $boundings->y1 - $boundings->y0 ) * $this->options->legendSymbolGleamSize
                            ),
                            $bottomRight = new ezcGraphCoordinate(
                                $boundings->x1 - ( $boundings->x1 - $boundings->x0 ) * $this->options->legendSymbolGleamSize,
                                $boundings->y1 - ( $boundings->y1 - $boundings->y0 ) * $this->options->legendSymbolGleamSize
                            ),
                            new ezcGraphCoordinate(
                                $boundings->x0 + ( $boundings->x1 - $boundings->x0 ) * $this->options->legendSymbolGleamSize,
                                $boundings->y1 - ( $boundings->y1 - $boundings->y0 ) * $this->options->legendSymbolGleamSize
                            ),
                        ),
                        new ezcGraphLinearGradient(
                            $bottomRight,
                            $topLeft,
                            $color->darken( -$this->options->legendSymbolGleam ),
                            $color->darken( $this->options->legendSymbolGleam )
                        ),
                        true
                    );
                }
return $return;

Also we have to add to the Graph/graph.php file in the class ezcGraph the constant:


const SQUARE = 4;

Now we can use a new symbol for our line graphs. It is possible to create some DIABOLO symbols just changing the order or the boundings...


Environment:

Operating System: Ubuntu Linux 8.10
PHP Version: 5.2.6-2ubuntu4
Database and version: n/a
Browser (and version): Firefox


Steps to Reproduce:

- Edit Graph/interfaces/renderer.php and paste first code into the drawSymbol() public funcion.

- Edit Graph/graph.php and paste second code inside the ezcGraph class.

- You can use the new symbol with: ezcGraph::SQUARE


- Attachments

No attachments for this issue.


- Comments

Sorry, this is not a bug but an enhancement

#259511 by Raul Mateos on December 15th, 2008 [Permanent Link]

const value 4 is used by arrow, this should be:

const SQUARE = 5;

#259575 by Raul Mateos on December 18th, 2008 [Permanent Link]

Implemented in revision #9766.

Also implemented new data symbol "BOX", which basically is a non-filled square.

#259861 by Kore Nordmann on January 20th, 2009 [Permanent Link]

- History
Properties
Type Enhancement
Priority Medium
Component Components » Graph
Affects Unknown
Fix Version 2009.1alpha1 - eZ components 2009.1alpha1
Reporter Raul Mateos
Responsible Kore Nordmann
Status 0 Closed
Resolution Implemented
Created December 15th, 2008
Updated January 20th, 2009
Resolved January 20th, 2009
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels