diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2007-08-10 09:24:49 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2007-08-10 09:24:49 +0000 |
commit | 679c5d855f5640e2888537bd3cab623503b6c0e0 (patch) | |
tree | a37cb7702f066223fc6fb2eedcce154e138a589f /src/options | |
parent | 9ffa22267933bdaa8d490d36ae5a78c722e23527 (diff) | |
download | zetacomponents-graph-679c5d855f5640e2888537bd3cab623503b6c0e0.zip zetacomponents-graph-679c5d855f5640e2888537bd3cab623503b6c0e0.tar.gz |
- Enhanced documentation
- Added examples to most of the classes
- Fixed class descriptions
- Refence options classes which may be used to configure the current chart.
Diffstat (limited to 'src/options')
-rw-r--r-- | src/options/chart.php | 27 | ||||
-rw-r--r-- | src/options/driver.php | 22 | ||||
-rw-r--r-- | src/options/flash_driver.php | 25 | ||||
-rw-r--r-- | src/options/font.php | 32 | ||||
-rw-r--r-- | src/options/gd_driver.php | 28 | ||||
-rw-r--r-- | src/options/line_chart.php | 18 | ||||
-rw-r--r-- | src/options/pie_chart.php | 23 | ||||
-rw-r--r-- | src/options/radar_chart.php | 20 | ||||
-rw-r--r-- | src/options/renderer.php | 24 | ||||
-rw-r--r-- | src/options/renderer_2d.php | 39 | ||||
-rw-r--r-- | src/options/renderer_3d.php | 41 | ||||
-rw-r--r-- | src/options/svg_driver.php | 23 |
12 files changed, 309 insertions, 13 deletions
diff --git a/src/options/chart.php b/src/options/chart.php index 91b21a4..e958003 100644 --- a/src/options/chart.php +++ b/src/options/chart.php @@ -8,7 +8,32 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for charts + * Class containing the basic options for charts. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->palette = new ezcGraphPaletteEzBlue(); + * $graph->title = 'Access statistics'; + * + * // Global font options + * $graph->options->font->name = 'serif'; + * + * // Special font options for sub elements + * $graph->title->background = '#EEEEEC'; + * $graph->title->font->name = 'sans-serif'; + * + * $graph->options->font->maxFontSize = 8; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * + * $graph->render( 400, 150, 'tutorial_chart_title.svg' ); + * </code> * * @property int $width * Width of the chart. diff --git a/src/options/driver.php b/src/options/driver.php index 97cfebe..a69c479 100644 --- a/src/options/driver.php +++ b/src/options/driver.php @@ -8,7 +8,27 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for charts + * Class containing the basic driver options. + * + * <code> + * require_once 'tutorial_autoload.php'; + * + * $graph = new ezcGraphPieChart(); + * $graph->palette = new ezcGraphPaletteEzBlue(); + * $graph->title = 'Access statistics'; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * + * $graph->driver->options->autoShortenString = false; + * + * $graph->render( 400, 150, 'tutorial_chart_title.svg' ); + * </code> * * @property int $width * Width of the chart. diff --git a/src/options/flash_driver.php b/src/options/flash_driver.php index ecf66fe..6b6306b 100644 --- a/src/options/flash_driver.php +++ b/src/options/flash_driver.php @@ -8,7 +8,30 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for charts + * Class containing the extended configuration options for the flash driver. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->title = 'Access statistics'; + * $graph->legend = false; + * + * $graph->driver = new ezcGraphFlashDriver(); + * $graph->driver->options->compresion = 0; + * + * $graph->options->font = 'tutorial_font.fdb'; + * + * $graph->driver->options->compression = 7; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * + * $graph->render( 400, 200, 'tutorial_driver_flash.swf' ); + * </code> * * @property int $compression * Compression level used for generated flash file diff --git a/src/options/font.php b/src/options/font.php index 236931f..ab700f7 100644 --- a/src/options/font.php +++ b/src/options/font.php @@ -8,13 +8,41 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for charts + * Class containing the options for font configuration. + * + * Global font settings will only affect the font settings of chart elements + * until they were modified once. Form then on the font configuration of one + * chart element has been copied and can only be configured independently. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->palette = new ezcGraphPaletteEzBlue(); + * $graph->title = 'Access statistics'; + * + * $graph->options->font->name = 'serif'; + * $graph->options->font->maxFontSize = 12; + * + * $graph->title->background = '#EEEEEC'; + * $graph->title->font->name = 'sans-serif'; + * + * $graph->options->font->maxFontSize = 8; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * + * $graph->render( 400, 150, 'tutorial_chart_title.svg' ); + * </code> * * @property string $name * Name of font. * @property string $path * Path to font file. - * @property string $type + * @property int $type * Type of used font. May be one of the following: * - TTF_FONT Native TTF fonts * - PS_FONT PostScript Type1 fonts diff --git a/src/options/gd_driver.php b/src/options/gd_driver.php index 2a3f10a..a9e258c 100644 --- a/src/options/gd_driver.php +++ b/src/options/gd_driver.php @@ -8,7 +8,33 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for charts + * Class containing the extended driver options for the gd driver. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->palette = new ezcGraphPaletteEzGreen(); + * $graph->title = 'Access statistics'; + * $graph->legend = false; + * + * $graph->driver = new ezcGraphGdDriver(); + * $graph->options->font = 'tutorial_font.ttf'; + * + * // Generate a Jpeg with lower quality. The default settings result in a better + * // quality image + * $graph->driver->options->supersampling = 1; + * $graph->driver->options->jpegQuality = 100; + * $graph->driver->options->imageFormat = IMG_JPEG; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * + * $graph->render( 400, 200, 'tutorial_dirver_gd.jpg' ); + * </code> * * @property int $imageFormat * Type of generated image. diff --git a/src/options/line_chart.php b/src/options/line_chart.php index 8b52261..f5f41f9 100644 --- a/src/options/line_chart.php +++ b/src/options/line_chart.php @@ -8,7 +8,23 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for line charts + * Class containing the basic options for line charts. + * + * <code> + * $graph = new ezcGraphLineChart(); + * $graph->title = 'Wikipedia articles'; + * + * $graph->options->fillLines = 220; + * $graph->options->lineThickness = 3; + * + * // Add data + * foreach ( $wikidata as $language => $data ) + * { + * $graph->data[$language] = new ezcGraphArrayDataSet( $data ); + * } + * + * $graph->render( 400, 150, 'tutorial_line_chart.svg' ); + * </code> * * @property float $lineThickness * Theickness of chart lines diff --git a/src/options/pie_chart.php b/src/options/pie_chart.php index de7b12d..b67759e 100644 --- a/src/options/pie_chart.php +++ b/src/options/pie_chart.php @@ -8,7 +8,28 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for pie charts + * Class containing the basic options for pie charts. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->palette = new ezcGraphPaletteEzRed(); + * $graph->title = 'Access statistics'; + * $graph->legend = false; + * + * $graph->options->label = '%1$s (%3$.1f)'; + * $graph->options->percentThreshold = .05; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * $graph->data['Access statistics']->highlight['Explorer'] = true; + * + * $graph->render( 400, 150, 'tutorial_pie_chart_options.svg' ); + * </code> * * @property string $label * String used to label pies diff --git a/src/options/radar_chart.php b/src/options/radar_chart.php index 3daf3f8..ab3b933 100644 --- a/src/options/radar_chart.php +++ b/src/options/radar_chart.php @@ -8,7 +8,25 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for line charts + * Class containing the basic options for radar charts. + * + * <code> + * $wikidata = include 'tutorial_wikipedia_data.php'; + * + * $graph = new ezcGraphRadarChart(); + * $graph->title = 'Wikipedia articles'; + * + * $graph->options->fillLines = 220; + * + * // Add data + * foreach ( $wikidata as $language => $data ) + * { + * $graph->data[$language] = new ezcGraphArrayDataSet( $data ); + * $graph->data[$language][] = reset( $data ); + * } + * + * $graph->render( 400, 150, 'tutorial_radar_chart.svg' ); + * </code> * * @property float $lineThickness * Theickness of chart lines diff --git a/src/options/renderer.php b/src/options/renderer.php index 60ff7eb..bb6efc5 100644 --- a/src/options/renderer.php +++ b/src/options/renderer.php @@ -8,7 +8,29 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for pie charts + * Class containing the basic options for renderers. + * + * <code> + * $wikidata = include 'tutorial_wikipedia_data.php'; + * + * $graph = new ezcGraphBarChart(); + * $graph->title = 'Wikipedia articles'; + * + * // Add data + * foreach ( $wikidata as $language => $data ) + * { + * $graph->data[$language] = new ezcGraphArrayDataSet( $data ); + * } + * + * // $graph->renderer = new ezcGraphRenderer2d(); + * + * $graph->renderer->options->barMargin = .2; + * $graph->renderer->options->barPadding = .2; + * + * $graph->renderer->options->dataBorder = 0; + * + * $graph->render( 400, 150, 'tutorial_bar_chart_options.svg' ); + * </code> * * @property float $maxLabelHeight * Percent of chart height used as maximum height for pie chart diff --git a/src/options/renderer_2d.php b/src/options/renderer_2d.php index 6a9530f..dc7b5d1 100644 --- a/src/options/renderer_2d.php +++ b/src/options/renderer_2d.php @@ -8,7 +8,44 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for pie charts + * Class containing the extended options available in 2d renderer. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->palette = new ezcGraphPaletteBlack(); + * $graph->title = 'Access statistics'; + * $graph->options->label = '%2$d (%3$.1f%%)'; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * $graph->data['Access statistics']->highlight['Explorer'] = true; + * + * // $graph->renderer = new ezcGraphRenderer2d(); + * + * $graph->renderer->options->moveOut = .2; + * + * $graph->renderer->options->pieChartOffset = 63; + * + * $graph->renderer->options->pieChartGleam = .3; + * $graph->renderer->options->pieChartGleamColor = '#FFFFFF'; + * $graph->renderer->options->pieChartGleamBorder = 2; + * + * $graph->renderer->options->pieChartShadowSize = 3; + * $graph->renderer->options->pieChartShadowColor = '#000000'; + * + * $graph->renderer->options->legendSymbolGleam = .5; + * $graph->renderer->options->legendSymbolGleamSize = .9; + * $graph->renderer->options->legendSymbolGleamColor = '#FFFFFF'; + * + * $graph->renderer->options->pieChartSymbolColor = '#BABDB688'; + * + * $graph->render( 400, 150, 'tutorial_pie_chart_pimped.svg' ); + * </code> * * @property int $pieChartShadowSize * Size of shadows. diff --git a/src/options/renderer_3d.php b/src/options/renderer_3d.php index dd6cd8e..54f7377 100644 --- a/src/options/renderer_3d.php +++ b/src/options/renderer_3d.php @@ -8,7 +8,46 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for pie charts + * Class containing the extended options for the three dimensional renderer. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->palette = new ezcGraphPaletteEzRed(); + * $graph->title = 'Access statistics'; + * $graph->options->label = '%2$d (%3$.1f%%)'; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * $graph->data['Access statistics']->highlight['Explorer'] = true; + * + * $graph->renderer = new ezcGraphRenderer3d(); + * + * $graph->renderer->options->moveOut = .2; + * + * $graph->renderer->options->pieChartOffset = 63; + * + * $graph->renderer->options->pieChartGleam = .3; + * $graph->renderer->options->pieChartGleamColor = '#FFFFFF'; + * + * $graph->renderer->options->pieChartShadowSize = 5; + * $graph->renderer->options->pieChartShadowColor = '#000000'; + * + * $graph->renderer->options->legendSymbolGleam = .5; + * $graph->renderer->options->legendSymbolGleamSize = .9; + * $graph->renderer->options->legendSymbolGleamColor = '#FFFFFF'; + * + * $graph->renderer->options->pieChartSymbolColor = '#55575388'; + * + * $graph->renderer->options->pieChartHeight = 5; + * $graph->renderer->options->pieChartRotation = .8; + * + * $graph->render( 400, 150, 'tutorial_pie_chart_3d.svg' ); + * </code> * * @property bool $seperateLines * Indicates wheather the full depth should be used for each line in diff --git a/src/options/svg_driver.php b/src/options/svg_driver.php index 0b9b0be..e93570d 100644 --- a/src/options/svg_driver.php +++ b/src/options/svg_driver.php @@ -8,7 +8,28 @@ * @license http://ez.no/licenses/new_bsd New BSD License */ /** - * Class containing the basic options for charts + * Class containing the extended options for the SVG driver. + * + * <code> + * $graph = new ezcGraphPieChart(); + * $graph->background->color = '#FFFFFFFF'; + * $graph->title = 'Access statistics'; + * $graph->legend = false; + * + * $graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + * 'Mozilla' => 19113, + * 'Explorer' => 10917, + * 'Opera' => 1464, + * 'Safari' => 652, + * 'Konqueror' => 474, + * ) ); + * + * $graph->driver->options->templateDocument = dirname( __FILE__ ) . '/template.svg'; + * $graph->driver->options->graphOffset = new ezcGraphCoordinate( 25, 40 ); + * $graph->driver->options->insertIntoGroup = 'ezcGraph'; + * + * $graph->render( 400, 200, 'tutorial_driver_svg.svg' ); + * </code> * * @property string $encoding * Encoding of the SVG XML document |