如何在 Symfony 上实现 Open Flash Chart 2

发布于 2024-08-24 22:40:23 字数 933 浏览 5 评论 0原文

我试图通过在我的控制器操作之一中包含 ofc2 库来在我的 symfony 项目上使用 Open Flash Chart 2

不幸的是它不起作用。当我调用该操作时它不打印任何内容 :'(

有一个插件可以实现此目的,但它使用的是过时的 OFC 版本。

有人在其网站上成功显示过 Open Flash Chart 2 吗?

以下是方法我的控制器的操作文件看起来:

<?php

class chartActions extends sfActions{

    public function executeTestChartData(sfWebRequest $request){
        $this->getResponse()->setHttpHeader('Content-Type','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);
    }
}

?>

提前致谢,

Vic

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','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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剩余の解释 2024-08-31 22:40:24

好吧,我终于解决了。这就是我所做的:

  1. open-flash-chart.php 复制到 /lib/php-ofc-library
  2. 将 OFC2 php 库中包含的其余文件复制到 < code>/apps/my-app/lib 目录
  3. 最后,从我的控制器中删除了 include('/lib/php-ofc-library/open-flash-chart.php');行动。

就是这样。不要忘记清除缓存。

干杯

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文