I'm trying to use Open Flash Chart 2 on my symfony project by including the ofc2 library on one of my controller's action.
Unfortunately it doesn't work. When i call the action it prints nothing :'(
There is a plugin for this, but it uses an outdated version of OFC.
Anyone have had any success showing Open Flash Chart 2 on their site?
Here's how my controller's actions file looks:
<?php
class chartActions extends sfActions{
public function executeTestChartData(sfWebRequest $request){
$this->getResponse()->setHttpHeader('Content-Type'开发者_如何学C,'text/plain');
include('/cidat/lib/php-ofc-library/open-flash-chart.php');
$title = new title( date("D M d Y") );
$bar = new bar();
$bar->set_values( array(9,8,7,6,5,4,3,2,1) );
$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $bar );
$output = $chart->toPrettyString();
return $this->renderText($output);
}
}
?>
Thanks in advance,
Vic
Ok, I finally solved it. Here's what I did:
- Copied
open-flash-chart.php
to/lib/php-ofc-library
- Copied the rest of the files included in the OFC2 php lib to
/apps/my-app/lib
directory - Last, removed
include('/lib/php-ofc-library/open-flash-chart.php');
from my controller's action.
That's it. Don't forget to clear cache.
Cheers
精彩评论