malwarebytes/altamirabundle

Pretty JS Charts for Symfony using the Altamira library

Installs: 281

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 4

Open Issues: 1

Language:JavaScript

dev-master 2013-01-24 18:52 UTC

This package is not auto-updated.

Last update: 2021-10-01 22:50:41 UTC


README

A PHP abstraction library for JavaScript charting built as a Symfony 2 service bundle.

The following libraries are linked to this bundle via git submodules:

  • Jquery
  • Flot
  • jqPlot

You can jump to any version by checking out the version you want to use via the git submodule.

Getting Started

  • Prerequisites: You need a working Symfony2 framework installed and setup.

IMPORTANT - Please follow the directions in order or the JS library dependencies will not be properly built

  1. Add the AltamiraBundle ScriptHandler to the post-install-cmd and post-update-cmd section in scripts in your composer.json file.

        "scripts": {
            "post-install-cmd": [
                "Malwarebytes\\AltamiraBundle\\ScriptHandler::installJSDependencies",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    
            ],
            "post-update-cmd": [
                "Malwarebytes\\AltamiraBundle\\ScriptHandler::installJSDependencies",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
                "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
            ]
        }

    NOTE You must add our bundle first before installAssets or you will have to re-run install assets manually.

  2. Now install the altamira-bundle via composer.

    From your main symfony2 directory, run:

    $ composer require malwarebytes/altamirabundle:dev-master
  3. Enable the bundle within symfony:

    <?php
    // app/AppKernel.php
    
    public function registerBundles()
    {
         $bundlles = array (
             // ...
             new Malwarebytes\AltamiraBundle\MalwarebytesAltamiraBundle(),
         );
    }
  4. If you would like to see example code, enable the example controller:

    # app/config/routing.yml
    
    altamira_example:
        resource: "@MalwarebytesAltamiraBundle/Resources/config/routing.yml"
        prefix:   /chart_demo

Troubleshooting

If there are javascript files missing when you view the example, the JS dependencies may not have been fetched properly. Check that the folders in Resources/public/js/ are not empty.

If code exists in the libs folder, the assets may have failed to be installed into the web folder. Run the following to regenerate the assets:

$ app/console assets:install

Developing

Refer to the sample controller on examples on how to use the code.