diff options
Diffstat (limited to 'docs/tutorial')
39 files changed, 1090 insertions, 0 deletions
diff --git a/docs/tutorial/ez.png b/docs/tutorial/ez.png Binary files differnew file mode 100644 index 0000000..42f4799 --- /dev/null +++ b/docs/tutorial/ez.png diff --git a/docs/tutorial/template.svg b/docs/tutorial/template.svg new file mode 100644 index 0000000..6156891 --- /dev/null +++ b/docs/tutorial/template.svg @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="450" + height="250" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.44.1" + version="1.0" + sodipodi:docbase="/home/kore/devel/ezcomponents/trunk/Graph/docs" + sodipodi:docname="template.svg"> + <defs + id="defs4"> + <linearGradient + inkscape:collect="always" + id="linearGradient16118"> + <stop + style="stop-color:white;stop-opacity:1;" + offset="0" + id="stop16120" /> + <stop + style="stop-color:white;stop-opacity:0;" + offset="1" + id="stop16122" /> + </linearGradient> + <linearGradient + id="linearGradient3647"> + <stop + style="stop-color:#204a8f;stop-opacity:0.94117647;" + offset="0" + id="stop3649" /> + <stop + style="stop-color:#729fcf;stop-opacity:1;" + offset="1" + id="stop3651" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3647" + id="linearGradient3653" + x1="449.50012" + y1="249.5" + x2="0.49999967" + y2="0.5000025" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1.002227,0,0,1.004016,-0.501113,-0.502011)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient16118" + id="linearGradient16116" + x1="104.98172" + y1="-14.882813" + x2="104.98172" + y2="-31.496094" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(336.4453,-2.121318)" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1" + inkscape:cx="225" + inkscape:cy="125" + inkscape:document-units="px" + inkscape:current-layer="layer1" + width="450px" + height="250px" + inkscape:window-width="1024" + inkscape:window-height="699" + inkscape:window-x="0" + inkscape:window-y="24" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="opacity:1;fill:url(#linearGradient3653);fill-opacity:1;stroke:none;stroke-width:0.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect2760" + width="450" + height="250" + x="0" + y="-1.7763568e-15" /> + <rect + style="opacity:1;fill:white;fill-opacity:0.58823532;stroke:white;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect1872" + width="399" + height="199" + x="25.5" + y="40.5" + rx="0" + ry="0" /> + <path + style="opacity:0.5;fill:white;fill-opacity:1;stroke:none;stroke-width:0.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 50.46875 0 L 74.625 8.21875 L 0 55.5625 L 0 61.53125 L 80.75 10.3125 L 141.03125 30.84375 L 73.5 89.03125 L 0 67.75 L 0 73 L 69 92.9375 L 0 152.40625 L 0 159.03125 L 74.71875 94.625 L 157.25 118.5 L 101.0625 186.40625 L 0 161.6875 L 0 166.8125 L 97.53125 190.6875 L 48.46875 250 L 54.9375 250 L 102.9375 192 L 206.375 217.3125 L 188.28125 250 L 193.96875 250 L 211.375 218.53125 L 312.5625 243.28125 L 310.25 250 L 315.53125 250 L 317.4375 244.46875 L 340.03125 250 L 361 250 L 319.09375 239.75 L 342.53125 172.09375 L 436.0625 199.15625 L 429.6875 250 L 434.75 250 L 440.9375 200.5625 L 450 203.1875 L 450 198 L 441.5625 195.5625 L 449.0625 135.6875 L 450 136 L 450 130.71875 L 449.6875 130.625 L 450 128.125 L 450 87.71875 L 444.84375 128.96875 L 366.6875 102.34375 L 384.8125 49.96875 L 450 73.34375 L 450 68.03125 L 386.46875 45.25 L 400.8125 3.8125 L 450 23.21875 L 450 17.84375 L 404.78125 0 L 391.15625 0 L 396.15625 1.96875 L 381.75 43.5625 L 320.375 21.53125 L 332.28125 0 L 326.5625 0 L 315.59375 19.84375 L 261.4375 0.40625 L 261.78125 0 L 245.4375 0 L 253.03125 2.71875 L 213.6875 50.25 L 150.96875 28.90625 L 184.5 0 L 176.8125 0 L 145.4375 27.03125 L 86.1875 6.84375 L 96.96875 0 L 87.59375 0 L 80.0625 4.78125 L 66.03125 0 L 50.46875 0 z M 258.03125 4.53125 L 313.125 24.28125 L 285.28125 74.625 L 218.75 52 L 258.03125 4.53125 z M 317.90625 26 L 380.125 48.28125 L 361.9375 100.75 L 290.09375 76.28125 L 317.90625 26 z M 146.5625 32.71875 L 210.25 54.40625 L 160.71875 114.28125 L 79.25 90.71875 L 146.5625 32.71875 z M 215.34375 56.125 L 282.8125 79.09375 L 249.1875 139.875 L 165.96875 115.8125 L 215.34375 56.125 z M 287.625 80.75 L 360.3125 105.46875 L 339.34375 165.96875 L 254.125 141.3125 L 287.625 80.75 z M 365.03125 107.09375 L 444.21875 134.0625 L 436.6875 194.15625 L 344.15625 167.375 L 365.03125 107.09375 z M 162.5 120 L 246.71875 144.375 L 208.875 212.78125 L 106.46875 187.71875 L 162.5 120 z M 251.625 145.78125 L 337.71875 170.6875 L 314.21875 238.5625 L 213.875 214 L 251.625 145.78125 z " + id="rect5461" /> + <rect + ry="0" + rx="0" + y="36.5" + x="29.5" + height="199" + width="399" + id="rect7236" + style="opacity:0.8;fill:none;fill-opacity:1;stroke:white;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <rect + style="opacity:0.6;fill:none;fill-opacity:1;stroke:white;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect7238" + width="399" + height="199" + x="33.5" + y="32.5" + rx="0" + ry="0" /> + <rect + ry="0" + rx="0" + y="28.5" + x="37.5" + height="199" + width="399" + id="rect7240" + style="opacity:0.4;fill:none;fill-opacity:1;stroke:white;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <rect + style="opacity:0.2;fill:none;fill-opacity:1;stroke:white;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect9014" + width="399" + height="199" + x="41.5" + y="24.5" + rx="0" + ry="0" /> + <rect + ry="0" + rx="0" + y="20.5" + x="45.5" + height="199" + width="399" + id="rect9016" + style="opacity:0.1;fill:none;fill-opacity:1;stroke:white;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <text + xml:space="preserve" + style="font-size:17.16649818px;font-style:normal;font-weight:normal;fill:white;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + x="361.1604" + y="20.04665" + id="text14332"><tspan + sodipodi:role="line" + id="tspan14334" + x="361.1604" + y="20.04665">ezcGraph</tspan></text> + <text + id="text15221" + y="-20.574902" + x="361.1604" + style="font-size:17.16649818px;font-style:normal;font-weight:normal;opacity:0.67307691;fill:url(#linearGradient16116);fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + xml:space="preserve" + transform="scale(1,-1)"><tspan + y="-20.574902" + x="361.1604" + id="tspan15223" + sodipodi:role="line" + style="fill:url(#linearGradient16116);fill-opacity:1">ezcGraph</tspan></text> + <g id="ezcGraph" /> + </g> +</svg> diff --git a/docs/tutorial/tutorial_autoload.php b/docs/tutorial/tutorial_autoload.php new file mode 100644 index 0000000..8b197de --- /dev/null +++ b/docs/tutorial/tutorial_autoload.php @@ -0,0 +1,20 @@ +<?php +$dir = dirname( dirname( __FILE__ ) ); +$dirParts = explode( '/', $dir ); +switch ( $dirParts[count( $dirParts ) - 3] ) +{ + case 'doc': require_once 'ezc/Base/base.php'; break; // pear + case 'trunk': require_once "$dir/../../Base/src/base.php"; break; // svn + default: require_once "$dir/../../Base/src/base.php"; break; // bundle +} + +/** + * Autoload ezc classes + * + * @param string $className + */ +function __autoload( $className ) +{ + ezcBase::autoload( $className ); +} +?> diff --git a/docs/tutorial/tutorial_axis_datetime.php b/docs/tutorial/tutorial_axis_datetime.php new file mode 100644 index 0000000..a638d20 --- /dev/null +++ b/docs/tutorial/tutorial_axis_datetime.php @@ -0,0 +1,33 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphLineChart(); +$graph->options->fillLines = 210; +$graph->title = 'Concurrent requests'; +$graph->legend = false; + +$graph->xAxis = new ezcGraphChartElementDateAxis(); + +// Add data +$graph->data['Machine 1'] = new ezcGraphArrayDataSet( array( + '8:00' => 3241, + '8:13' => 934, + '8:24' => 1201, + '8:27' => 1752, + '8:51' => 123, +) ); +$graph->data['Machine 2'] = new ezcGraphArrayDataSet( array( + '8:05' => 623, + '8:12' => 2103, + '8:33' => 543, + '8:43' => 2034, + '8:59' => 3410, +) ); + +$graph->data['Machine 1']->symbol = ezcGraph::BULLET; +$graph->data['Machine 2']->symbol = ezcGraph::BULLET; + +$graph->render( 400, 150, 'tutorial_axis_datetime.svg' ); + +?> diff --git a/docs/tutorial/tutorial_axis_labeled.php b/docs/tutorial/tutorial_axis_labeled.php new file mode 100644 index 0000000..10419d8 --- /dev/null +++ b/docs/tutorial/tutorial_axis_labeled.php @@ -0,0 +1,31 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphLineChart(); +$graph->options->fillLines = 210; +$graph->options->font->maxFontSize = 10; +$graph->title = 'Error level colors'; +$graph->legend = false; + +$graph->yAxis = new ezcGraphChartElementLabeledAxis(); +$graph->yAxis->axisLabelRenderer->showZeroValue = true; + +$graph->yAxis->label = 'Color'; +$graph->xAxis->label = 'Error level'; + +// Add data +$graph->data['colors'] = new ezcGraphArrayDataSet( + array( + 'info' => 'blue', + 'notice' => 'green', + 'warning' => 'orange', + 'error' => 'red', + 'fatal' => 'red', + ) +); + +$graph->render( 400, 150, 'tutorial_axis_labeled.svg' ); + +?> diff --git a/docs/tutorial/tutorial_axis_numeric.php b/docs/tutorial/tutorial_axis_numeric.php new file mode 100644 index 0000000..6dd55a6 --- /dev/null +++ b/docs/tutorial/tutorial_axis_numeric.php @@ -0,0 +1,32 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Some random data'; +$graph->legend = false; + +$graph->xAxis = new ezcGraphChartElementNumericAxis(); + +$graph->xAxis->min = -15; +$graph->xAxis->max = 15; +$graph->xAxis->majorStep = 5; + +$data = array( + array(), + array() +); +for ( $i = -10; $i <= 10; $i++ ) +{ + $data[0][$i] = mt_rand( -23, 59 ); + $data[1][$i] = mt_rand( -23, 59 ); +} + +// Add data +$graph->data['random blue'] = new ezcGraphArrayDataSet( $data[0] ); +$graph->data['random green'] = new ezcGraphArrayDataSet( $data[1] ); + +$graph->render( 400, 150, 'tutorial_axis_numeric.svg' ); + +?> diff --git a/docs/tutorial/tutorial_bar_chart.php b/docs/tutorial/tutorial_bar_chart.php new file mode 100644 index 0000000..1fb8451 --- /dev/null +++ b/docs/tutorial/tutorial_bar_chart.php @@ -0,0 +1,17 @@ +<?php + +require_once 'tutorial_autoload.php'; +$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->render( 400, 150, 'tutorial_bar_chart.svg' ); + +?> diff --git a/docs/tutorial/tutorial_bar_chart_3d.php b/docs/tutorial/tutorial_bar_chart_3d.php new file mode 100644 index 0000000..61a0146 --- /dev/null +++ b/docs/tutorial/tutorial_bar_chart_3d.php @@ -0,0 +1,26 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphBarChart(); +$graph->palette = new ezcGraphPaletteEz(); +$graph->title = 'Wikipedia articles'; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); +} +$graph->data['English']->symbol = ezcGraph::NO_SYMBOL; +$graph->data['German']->symbol = ezcGraph::BULLET; +$graph->data['Norwegian']->symbol = ezcGraph::DIAMOND; + +$graph->renderer = new ezcGraphRenderer3d(); + +$graph->renderer->options->legendSymbolGleam = .5; +$graph->renderer->options->barChartGleam = .5; + +$graph->render( 400, 150, 'tutorial_bar_chart_3d.svg' ); + +?> diff --git a/docs/tutorial/tutorial_bar_chart_options.php b/docs/tutorial/tutorial_bar_chart_options.php new file mode 100644 index 0000000..cf035cf --- /dev/null +++ b/docs/tutorial/tutorial_bar_chart_options.php @@ -0,0 +1,35 @@ +<?php + +require_once 'tutorial_autoload.php'; +$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->data['German']->displayType = ezcGraph::LINE; +$graph->data['German']->highlight = true; +$graph->data['German']->highlight['Mar 2006'] = false; + +$graph->options->fillLines = 210; + +$graph->options->highlightSize = 12; + +$graph->options->highlightFont->background = '#EEEEEC88'; +$graph->options->highlightFont->border = '#000000'; +$graph->options->highlightFont->borderWidth = 1; + +// $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' ); + +?> diff --git a/docs/tutorial/tutorial_bar_line_chart.php b/docs/tutorial/tutorial_bar_line_chart.php new file mode 100644 index 0000000..16451bb --- /dev/null +++ b/docs/tutorial/tutorial_bar_line_chart.php @@ -0,0 +1,20 @@ +<?php + +require_once 'tutorial_autoload.php'; +$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->data['German']->displayType = ezcGraph::LINE; + +$graph->options->fillLines = 210; + +$graph->render( 400, 150, 'tutorial_bar_line_chart.svg' ); + +?> diff --git a/docs/tutorial/tutorial_bar_options.php b/docs/tutorial/tutorial_bar_options.php new file mode 100644 index 0000000..4dd846a --- /dev/null +++ b/docs/tutorial/tutorial_bar_options.php @@ -0,0 +1,28 @@ +<?php + +require_once 'tutorial_autoload.php'; +$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->data['German']->displayType = ezcGraph::LINE; +$graph->data['German']->highlight = true; +$graph->data['German']->highlight['Mar 2006'] = false; + +$graph->options->fillLines = 210; + +$graph->options->highlightSize = 12; + +$graph->options->highlightFont->background = '#EEEEEC88'; +$graph->options->highlightFont->border = '#000000'; +$graph->options->highlightFont->borderWidth = 1; + +$graph->render( 400, 150, 'tutorial_bar_options.svg' ); + +?> diff --git a/docs/tutorial/tutorial_chart_background.php b/docs/tutorial/tutorial_chart_background.php new file mode 100644 index 0000000..f68863f --- /dev/null +++ b/docs/tutorial/tutorial_chart_background.php @@ -0,0 +1,23 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEzRed(); +$graph->title = 'Access statistics'; + +$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 19113, + 'Explorer' => 10917, + 'Opera' => 1464, + 'Safari' => 652, + 'Konqueror' => 474, +) ); + +$graph->background->image = 'ez.png'; +$graph->background->position = ezcGraph::BOTTOM | ezcGraph::RIGHT; +$graph->background->repeat = ezcGraph::NO_REPEAT; + +$graph->render( 400, 150, 'tutorial_chart_background.svg' ); + +?> diff --git a/docs/tutorial/tutorial_chart_legend.php b/docs/tutorial/tutorial_chart_legend.php new file mode 100644 index 0000000..791b6b6 --- /dev/null +++ b/docs/tutorial/tutorial_chart_legend.php @@ -0,0 +1,21 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEzGreen(); +$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->render( 400, 150, 'tutorial_chart_legend.svg' ); + +?> diff --git a/docs/tutorial/tutorial_chart_title.php b/docs/tutorial/tutorial_chart_title.php new file mode 100644 index 0000000..a8cb9c2 --- /dev/null +++ b/docs/tutorial/tutorial_chart_title.php @@ -0,0 +1,26 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEzBlue(); +$graph->title = 'Access statistics'; + +$graph->options->font->name = 'serif'; + +$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' ); + +?> diff --git a/docs/tutorial/tutorial_custom_palette.php b/docs/tutorial/tutorial_custom_palette.php new file mode 100644 index 0000000..179abee --- /dev/null +++ b/docs/tutorial/tutorial_custom_palette.php @@ -0,0 +1,22 @@ +<?php + +require_once 'tutorial_autoload.php'; +require_once 'tutorial_custom_palette_palette.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphBarChart(); +$graph->palette = new tutorialCustomPalette(); +$graph->title = 'Wikipedia articles'; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); +} +$graph->data['German']->displayType = ezcGraph::LINE; + +$graph->options->fillLines = 210; + +$graph->render( 400, 150, 'tutorial_custom_palette.svg' ); + +?> diff --git a/docs/tutorial/tutorial_custom_palette_palette.php b/docs/tutorial/tutorial_custom_palette_palette.php new file mode 100644 index 0000000..13c6b63 --- /dev/null +++ b/docs/tutorial/tutorial_custom_palette_palette.php @@ -0,0 +1,24 @@ +<?php + +class tutorialCustomPalette extends ezcGraphPalette +{ + protected $axisColor = '#000000'; + + protected $majorGridColor = '#000000BB'; + + protected $dataSetColor = array( + '#4E9A0688', + '#3465A4', + '#F57900' + ); + + protected $dataSetSymbol = array( + ezcGraph::BULLET, + ); + + protected $fontName = 'sans-serif'; + + protected $fontColor = '#555753'; +} + +?> diff --git a/docs/tutorial/tutorial_dataset_average.php b/docs/tutorial/tutorial_dataset_average.php new file mode 100644 index 0000000..4d8134a --- /dev/null +++ b/docs/tutorial/tutorial_dataset_average.php @@ -0,0 +1,25 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Some random data'; +$graph->legend->position = ezcGraph::BOTTOM; + +$graph->xAxis = new ezcGraphChartElementNumericAxis(); + +$data = array(); +for ( $i = 0; $i <= 10; $i++ ) +{ + $data[$i] = mt_rand( -5, 5 ); +} + +// Add data +$graph->data['random data'] = $dataset = new ezcGraphArrayDataSet( $data ); + +$average = new ezcGraphDataSetAveragePolynom( $dataset, 3 ); +$graph->data[(string) $average->getPolynom()] = $average; + +$graph->render( 400, 150, 'tutorial_dataset_average.svg' ); + +?> diff --git a/docs/tutorial/tutorial_dataset_numeric.php b/docs/tutorial/tutorial_dataset_numeric.php new file mode 100644 index 0000000..1694caf --- /dev/null +++ b/docs/tutorial/tutorial_dataset_numeric.php @@ -0,0 +1,24 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Sinus'; +$graph->legend->position = ezcGraph::BOTTOM; + +$graph->xAxis = new ezcGraphChartElementNumericAxis(); + +$graph->data['sinus'] = new ezcGraphNumericDataSet( + -360, // Start value + 360, // End value + create_function( + '$x', + 'return sin( deg2rad( $x ) );' + ) +); + +$graph->data['sinus']->resolution = 120; + +$graph->render( 400, 150, 'tutorial_dataset_numeric.svg' ); + +?> diff --git a/docs/tutorial/tutorial_driver_flash.php b/docs/tutorial/tutorial_driver_flash.php new file mode 100644 index 0000000..067e801 --- /dev/null +++ b/docs/tutorial/tutorial_driver_flash.php @@ -0,0 +1,31 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->title = 'Access statistics'; +$graph->legend = false; + +$graph->driver = new ezcGraphFlashDriver(); +$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->renderer = new ezcGraphRenderer3d(); +$graph->renderer->options->pieChartShadowSize = 10; +$graph->renderer->options->pieChartGleam = .5; +$graph->renderer->options->dataBorder = false; +$graph->renderer->options->pieChartHeight = 16; +$graph->renderer->options->legendSymbolGleam = .5; + +$graph->render( 400, 200, 'tutorial_driver_flash.swf' ); + +?> diff --git a/docs/tutorial/tutorial_driver_gd.php b/docs/tutorial/tutorial_driver_gd.php new file mode 100644 index 0000000..131ccf8 --- /dev/null +++ b/docs/tutorial/tutorial_driver_gd.php @@ -0,0 +1,27 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEzGreen(); +$graph->title = 'Access statistics'; +$graph->legend = false; + +$graph->driver = new ezcGraphGdDriver(); +$graph->options->font = 'tutorial_font.ttf'; + +$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' ); + +?> diff --git a/docs/tutorial/tutorial_driver_svg.php b/docs/tutorial/tutorial_driver_svg.php new file mode 100644 index 0000000..9f57333 --- /dev/null +++ b/docs/tutorial/tutorial_driver_svg.php @@ -0,0 +1,27 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEzGreen(); +$graph->title = 'Access statistics'; +$graph->legend = false; + +$graph->driver = new ezcGraphGdDriver(); +$graph->options->font = 'tutorial_font.ttf'; + +$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_driver_svg.jpg' ); + +?> diff --git a/docs/tutorial/tutorial_font.fdb b/docs/tutorial/tutorial_font.fdb Binary files differnew file mode 100644 index 0000000..5fefdcb --- /dev/null +++ b/docs/tutorial/tutorial_font.fdb diff --git a/docs/tutorial/tutorial_font.pfb b/docs/tutorial/tutorial_font.pfb Binary files differnew file mode 100644 index 0000000..130fac0 --- /dev/null +++ b/docs/tutorial/tutorial_font.pfb diff --git a/docs/tutorial/tutorial_font.ttf b/docs/tutorial/tutorial_font.ttf Binary files differnew file mode 100644 index 0000000..4b4ecc6 --- /dev/null +++ b/docs/tutorial/tutorial_font.ttf diff --git a/docs/tutorial/tutorial_legend_options.php b/docs/tutorial/tutorial_legend_options.php new file mode 100644 index 0000000..b12e040 --- /dev/null +++ b/docs/tutorial/tutorial_legend_options.php @@ -0,0 +1,23 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEz(); +$graph->title = 'Access statistics'; + +$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 19113, + 'Explorer' => 10917, + 'Opera' => 1464, + 'Safari' => 652, + 'Konqueror' => 474, +) ); + +$graph->legend->position = ezcGraph::BOTTOM; +$graph->legend->landscapeSize = .3; +$graph->legend->title = 'Legend'; + +$graph->render( 400, 150, 'tutorial_legend_options.svg' ); + +?> diff --git a/docs/tutorial/tutorial_line_chart.php b/docs/tutorial/tutorial_line_chart.php new file mode 100644 index 0000000..068e604 --- /dev/null +++ b/docs/tutorial/tutorial_line_chart.php @@ -0,0 +1,17 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Wikipedia articles'; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); +} + +$graph->render( 400, 150, 'tutorial_line_chart.svg' ); + +?> diff --git a/docs/tutorial/tutorial_line_chart_3d.php b/docs/tutorial/tutorial_line_chart_3d.php new file mode 100644 index 0000000..bac6e2d --- /dev/null +++ b/docs/tutorial/tutorial_line_chart_3d.php @@ -0,0 +1,28 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphLineChart(); +$graph->title = 'Some random data'; +$graph->legend->position = ezcGraph::BOTTOM; +$graph->options->fillLines = 210; + +$graph->xAxis = new ezcGraphChartElementNumericAxis(); + +$data = array(); +for ( $i = 0; $i <= 10; $i++ ) +{ + $data[$i] = mt_rand( -5, 5 ); +} + +// Add data +$graph->data['random data'] = $dataset = new ezcGraphArrayDataSet( $data ); + +$average = new ezcGraphDataSetAveragePolynom( $dataset, 3 ); +$graph->data[(string) $average->getPolynom()] = $average; + +$graph->renderer = new ezcGraphRenderer3d(); + +$graph->render( 400, 150, 'tutorial_line_chart_3d.svg' ); + +?> diff --git a/docs/tutorial/tutorial_modified_palette.php b/docs/tutorial/tutorial_modified_palette.php new file mode 100644 index 0000000..99a8ea7 --- /dev/null +++ b/docs/tutorial/tutorial_modified_palette.php @@ -0,0 +1,22 @@ +<?php + +require_once 'tutorial_autoload.php'; +require_once 'tutorial_custom_palette.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphBarChart(); +$graph->palette = new tutorialCustomPalette(); +$graph->title = 'Wikipedia articles'; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); +} +$graph->data['German']->displayType = ezcGraph::LINE; + +$graph->options->fillLines = 210; + +$graph->render( 400, 150, 'tutorial_modified_palette.svg' ); + +?> diff --git a/docs/tutorial/tutorial_output.php b/docs/tutorial/tutorial_output.php new file mode 100644 index 0000000..738c0e4 --- /dev/null +++ b/docs/tutorial/tutorial_output.php @@ -0,0 +1,19 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->title = 'Access statistics'; + +$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 19113, + 'Explorer' => 10917, + 'Opera' => 1464, + 'Safari' => 652, + 'Konqueror' => 474, +) ); +$graph->data['Access statistics']->highlight['Opera'] = true; + +$graph->renderToOutput( 400, 150 ); + +?> diff --git a/docs/tutorial/tutorial_pie_chart_3d.php b/docs/tutorial/tutorial_pie_chart_3d.php new file mode 100644 index 0000000..b5cdcaa --- /dev/null +++ b/docs/tutorial/tutorial_pie_chart_3d.php @@ -0,0 +1,42 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$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' ); + +?> diff --git a/docs/tutorial/tutorial_pie_chart_options.php b/docs/tutorial/tutorial_pie_chart_options.php new file mode 100644 index 0000000..7cf942f --- /dev/null +++ b/docs/tutorial/tutorial_pie_chart_options.php @@ -0,0 +1,34 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEzRed(); +$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->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 = 5; +$graph->renderer->options->pieChartShadowColor = '#BABDB6'; + +$graph->render( 400, 150, 'tutorial_pie_chart_options.svg' ); + +?> diff --git a/docs/tutorial/tutorial_pie_chart_pimped.php b/docs/tutorial/tutorial_pie_chart_pimped.php new file mode 100644 index 0000000..204e1aa --- /dev/null +++ b/docs/tutorial/tutorial_pie_chart_pimped.php @@ -0,0 +1,40 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$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' ); + +?> diff --git a/docs/tutorial/tutorial_pie_options.php b/docs/tutorial/tutorial_pie_options.php new file mode 100644 index 0000000..be8911f --- /dev/null +++ b/docs/tutorial/tutorial_pie_options.php @@ -0,0 +1,25 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->title = 'Elections 2005 Germany'; + +$graph->data['2005'] = new ezcGraphArrayDataSet( array( + 'CDU' => 35.2, + 'SPD' => 34.2, + 'FDP' => 9.8, + 'Die Gruenen' => 8.1, + 'PDS' => 8.7, + 'NDP' => 1.6, + 'REP' => 0.6, +) ); + +$graph->options->label = '%3$.1f%%'; +$graph->options->sum = 100; +$graph->options->percentThreshold = 0.02; +$graph->options->summarizeCaption = 'Others'; + +$graph->render( 400, 150, 'tutorial_pie_options.svg' ); + +?> diff --git a/docs/tutorial/tutorial_reference_gd.php b/docs/tutorial/tutorial_reference_gd.php new file mode 100644 index 0000000..905fef9 --- /dev/null +++ b/docs/tutorial/tutorial_reference_gd.php @@ -0,0 +1,41 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEzGreen(); +$graph->title = 'Access statistics'; + +$graph->driver = new ezcGraphGdDriver(); +$graph->options->font = 'tutorial_font.ttf'; + +$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 19113, + 'Explorer' => 10917, + 'Opera' => 1464, + 'Safari' => 652, + 'Konqueror' => 474, +) ); + +$graph->data['Access statistics']->url = 'http://example.org/'; +$graph->data['Access statistics']->url['Mozilla'] = 'http://example.org/mozilla'; + +$graph->render( 400, 200, 'tutorial_reference_gd.png' ); + +?> +<html> + <head><title>Image map example</title></head> +<body> +<?php + +echo ezcGraphTools::createImageMap( $graph, 'ezcGraphPieChartMap' ); + +?> + <img + src="tutorial_reference_gd.png" + width="400" height="200" + usemap="#ezcGraphPieChartMap" /> +</body> +</html> +<?php +?> diff --git a/docs/tutorial/tutorial_reference_svg.php b/docs/tutorial/tutorial_reference_svg.php new file mode 100644 index 0000000..61f18c1 --- /dev/null +++ b/docs/tutorial/tutorial_reference_svg.php @@ -0,0 +1,25 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->palette = new ezcGraphPaletteEz(); +$graph->title = 'Access statistics'; + +$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 19113, + 'Explorer' => 10917, + 'Opera' => 1464, + 'Safari' => 652, + 'Konqueror' => 474, +) ); + +$graph->data['Access statistics']->url = 'http://example.org/'; +$graph->data['Access statistics']->url['Mozilla'] = 'http://example.org/mozilla'; + +$graph->render( 400, 200, 'tutorial_reference_svg.svg' ); + +$graph->driver->options->linkCursor = 'crosshair'; +ezcGraphTools::linkSvgElements( $graph ); + +?> diff --git a/docs/tutorial/tutorial_renderer_3d.php b/docs/tutorial/tutorial_renderer_3d.php new file mode 100644 index 0000000..0d2d178 --- /dev/null +++ b/docs/tutorial/tutorial_renderer_3d.php @@ -0,0 +1,21 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->title = 'Access statistics'; + +$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 19113, + 'Explorer' => 10917, + 'Opera' => 1464, + 'Safari' => 652, + 'Konqueror' => 474, +) ); +$graph->data['Access statistics']->highlight['Opera'] = true; + +$graph->renderer = new ezcGraphRenderer3d(); + +$graph->render( 400, 150, 'tutorial_renderer_3d.svg' ); + +?> diff --git a/docs/tutorial/tutorial_simple_pie.php b/docs/tutorial/tutorial_simple_pie.php new file mode 100644 index 0000000..db2ca5e --- /dev/null +++ b/docs/tutorial/tutorial_simple_pie.php @@ -0,0 +1,19 @@ +<?php + +require_once 'tutorial_autoload.php'; + +$graph = new ezcGraphPieChart(); +$graph->title = 'Access statistics'; + +$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array( + 'Mozilla' => 19113, + 'Explorer' => 10917, + 'Opera' => 1464, + 'Safari' => 652, + 'Konqueror' => 474, +) ); +$graph->data['Access statistics']->highlight['Opera'] = true; + +$graph->render( 400, 150, 'tutorial_simple_pie.svg' ); + +?> diff --git a/docs/tutorial/tutorial_user_palette.php b/docs/tutorial/tutorial_user_palette.php new file mode 100644 index 0000000..507acc3 --- /dev/null +++ b/docs/tutorial/tutorial_user_palette.php @@ -0,0 +1,21 @@ +<?php + +require_once 'tutorial_autoload.php'; +$wikidata = include 'tutorial_wikipedia_data.php'; + +$graph = new ezcGraphBarChart(); +$graph->palette = new ezcGraphPaletteBlack(); +$graph->title = 'Wikipedia articles'; + +// Add data +foreach ( $wikidata as $language => $data ) +{ + $graph->data[$language] = new ezcGraphArrayDataSet( $data ); +} +$graph->data['German']->displayType = ezcGraph::LINE; + +$graph->options->fillLines = 210; + +$graph->render( 400, 150, 'tutorial_user_palette.svg' ); + +?> diff --git a/docs/tutorial/tutorial_wikipedia_data.php b/docs/tutorial/tutorial_wikipedia_data.php new file mode 100644 index 0000000..f4397bd --- /dev/null +++ b/docs/tutorial/tutorial_wikipedia_data.php @@ -0,0 +1,30 @@ +<?php + +return array( + 'English' => array( + 'Jan 2006' => 965, + 'Feb 2006' => 1000, + 'Mar 2006' => 1100, + 'Apr 2006' => 1100, + 'May 2006' => 1200, + 'Jun 2006' => 1300, + ), + 'German' => array( + 'Jan 2006' => 357, + 'Feb 2006' => 371, + 'Mar 2006' => 387, + 'Apr 2006' => 402, + 'May 2006' => 429, + 'Jun 2006' => 435, + ), + 'Norwegian' => array( + 'Jan 2006' => 49, + 'Feb 2006' => 52, + 'Mar 2006' => 56, + 'Apr 2006' => 59, + 'May 2006' => 63, + 'Jun 2006' => 67, + ), +); + +?> |