Welcome to OpenFlashChart2Widget Demo

OpenFlashChart2Widget is a small widget, that allows you to include OpenFlashChart2 charts in your website and was inspired by cr0t's yiiopenflashchart extension. But instead of utilizing components and providing a whole new API, this extension is meant to be used as a widget, which is configured with an object created by the OpenFlashChart2 PHP language binding.

In order to make OpenFlashChart2Widget working with your application, follow these steps:

  1. Copy the folder "OpenFlashChart2Widget" to your application's extension directory (I'll assume application.extensions). So your folder structure should now look like this:
    • ...
    • protected
      • ...
      • extensions
        • ...
        • OpenFlashChart2Widget
          • open-flash-chart-2-Lug-Wyrm-Charmer
          • swfobject
          • OpenFlashChart2Loader.php
          • OpenFlashChart2Widget.js
          • OpenFlashChart2Widget.php
        • ...
      • ...
    • ...
  2. Configure your application to find OpenFlashChart2Loader class (protected/config/main.php):
        // This is the main Web application configuration. Any writable
        // CWebApplication properties can be configured here.
        return array(
     
          // some stuff
     
          // autoloading model and component classes
          'import'=>array(
            'application.models.*',
            'application.components.*',
     
            // this is the interesting one...
            'application.extensions.OpenFlashChart2Widget.OpenFlashChart2Loader',
          ),
     
          // some more stuff
     
        );
  3. Before you create an OpenFlashChart2 object (which will later be passed to out widget), call OpenFlashChart2Loader::load(). This will prepare the OpenFlashChart2 PHP language binding and publish and register needed assets.
        class MyController extends Controller
        {
     
          public function actionChartRelated()
          {
            // ensure everything gets properly initialized
            OpenFlashChart2Loader::load();
            
            // fetch/generate a chart object
            $chart = ...
     
            $this->render('chartRelated', array(
              'chart' => $chart
            ));
          }
        }
  4. Use the widget in one of your views:
        $this->widget(
          'application.extensions.OpenFlashChart2Widget.OpenFlashChart2Widget',
          array(
            'chart' => $chart,  // this is an object created using OpenFlashChart2's
                                // PHP language binding.
            'width' => '100%',
          )
        );