开发者

How to implement Open Flash Chart 2 on Symfony

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:

  1. Copied open-flash-chart.php to /lib/php-ofc-library
  2. Copied the rest of the files included in the OFC2 php lib to /apps/my-app/lib directory
  3. 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜