All pastes #574867 Raw Edit

ezcGraph example

public php v1 · immutable
·published 2007-06-18 19:18 UTC
rendered paste body
<?phprequire_once 'ezc/Base/src/base.php';function __autoload($class) {	try {		ezcBase::autoload($class);	}	catch(Exception $e) {	}}	$graph = new ezcGraphLineChart();	$graph->background->color = '#FFFFFF';		$graph->options->font = 'verdana.ttf';	$graph->title->font->maxFontSize = 16;	$graph->options->font->maxFontSize = 8;	$graph->legend->font->maxFontSize = 10;		$graph->yAxis = new ezcGraphChartElementNumericAxis();	$graph->yAxis->min = 0;		$graph->xAxis = new ezcGraphChartElementLabeledAxis();	$graph->xAxis->axisLabelRenderer->showZeroValue = true;	$graph->xAxis->label = 'Week ';		$graph->driver = new ezcGraphGdDriver();	 	$graph->driver->options->supersampling = 1;	$graph->driver->options->jpegQuality = 100;	$graph->driver->options->imageFormat = IMG_JPEG;		if($template == 'fregetable') {		//$graph->yAxis->max = 10;		$graph->yAxis->label = 'Cups per Week';				$recommended = array();		for($i=1;$i<=10;$i++) {			$recommended[$i] = 5;		}		$graph->data['Recommended Intake'] = new ezcGraphArrayDataSet($recommended);		$graph->data['Recommended Intake']->color = '#FF0000';				$graph->data['Weekly Goal'] = new ezcGraphArrayDataSet($goals);		$graph->data['Weekly Goal']->symbol = ezcGraph::DIAMOND;		$graph->data['Weekly Goal']->color = '#0022FF';				$graph->data['Actual Intake'] = new ezcGraphArrayDataSet($intake);		$graph->data['Actual Intake']->symbol = ezcGraph::BULLET;		$graph->data['Actual Intake']->color = '#076F28';	}	else {		//$graph->yAxis->max = 840;		$graph->yAxis->label = 'Minutes per Week';				$recommended = array();		for($i=1;$i<=10;$i++) {			$recommended[$i] = 150;		}				$graph->data['Recommended Minutes'] = new ezcGraphArrayDataSet($recommended);		$graph->data['Recommended Minutes']->color = '#FF0000';				$graph->data['Weekly Goal'] = new ezcGraphArrayDataSet($goals);		$graph->data['Weekly Goal']->symbol = ezcGraph::BULLET;		$graph->data['Weekly Goal']->color = '#0022FF';				$graph->data['Actual Minutes'] = new ezcGraphArrayDataSet($output);		$graph->data['Actual Minutes']->symbol = ezcGraph::BULLET;		$graph->data['Actual Minutes']->color = '#076F28';	}		//$graph->legend->position = ezcGraph::BOTTOM; 	//$graph->legend->landscapeSize = .2;	$graph->legend = false;		$filename = ($template == 'fregetable') ? 'fruitvegetable' : 'exercise';	$graph->render(620, 250, 'graph_files/'.$filename.'.jpg');