gfazioli/morris-php

PHP helper classes for morris.js

Installs: 8

Dependents: 0

Suggesters: 0

Security: 0

Stars: 11

Watchers: 6

Forks: 5

Open Issues: 0

Language:JavaScript

0.6.0 2017-01-31 16:57 UTC

This package is auto-updated.

Last update: 2024-12-20 05:51:21 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

This project is a PHP part for Morris.js ( http://morrisjs.github.io/morris.js/ ).

You can use this PHP class to wrap the Morris Javascript class

Getting Started

  1. Download Morris Javascript lib from http://morrisjs.github.io/morris.js/
  2. Include main morris.php php file
  3. Include chart base morris-charts.php php file
  4. Include all or single chart that you like use

Getting Started with Composer

  1. Use composer.json

Examples

public function draw()
{
  ?>
  <div id="my-charts"></div>
<?php
  $morris = new Line( 'my-charts' );
  $morris->xkey = array( 'date' );
  $morris->ykeys = array( 'value' );
  $morris->labels = array( 'Money' );
  $morris->data = array(
    array( 'date' => '2010', 'value' => 88 ),
    array( 'date' => '2011', 'value' => 18 ),
    array( 'date' => '2012', 'value' => 28 ),
    array( 'date' => '2013', 'value' => 48 ),
  );
  echo $morris;
}