Skip to content

gfazioli/morris-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Morris PHP v0.6.0

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;
}