Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * This work is hereby released into the Public Domain.
- * To view a copy of the public domain dedication,
- * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
- * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
- *
- */
- require_once "../../BarPlot.class.php";
- $graph = new Graph(450, 400);
- $graph->setAntiAliasing(TRUE);
- $blue = new Color(0, 0, 200);
- $red = new Color(200, 0, 0);
- $group = new PlotGroup;
- $group->setPadding(40, 40);
- $group->setBackgroundColor(
- new Color(240, 240, 240)
- );
- $values = array(12, 8, 20, 32, 15, 5);
- $plot = new BarPlot($values, 1, 2);
- $plot->setBarColor($blue);
- $plot->setYAxis(Plot::LEFT);
- $group->add($plot);
- $group->axis->left->setColor($blue);
- $group->axis->left->title->set("Blue bars");
- $values = array(6, 12, 14, 2, 11, 7);
- $plot = new BarPlot($values, 2, 2);
- $plot->setBarColor($red);
- $plot->setYAxis(Plot::RIGHT);
- $group->add($plot);
- $group->axis->right->setColor($red);
- $group->axis->right->title->set("Red bars");
- $graph->add($group);
- $graph->draw();
- ?>
- class page_line extends Page {
- function init(){
- parent::init();
- $p=$this;
- $this->api->template->append('css_include', '<link type="text/css"
- href="./atk4-addons/sterling/jqplot/templates/js/jqplot/jquery.jqplot.css" rel="stylesheet" />'."n");
- $this->api->template->append('ie_include','<script type="text/javascript"
- src="./atk4-addons/sterling/jqplot/templates/js/jqplot/excanvas.min.js"></script>'."n");
- $this->api->template->append('js_include','<script type="text/javascript"
- src="./atk4-addons/sterling/jqplot/templates/js/jqplot/jquery.jqplot.min.js"></script>'."n");
- $this->js()->_load('jqplot_helper');
- $chart = $p->add('jqplot', null, 'chart1');
- $chart->setSeries(array(array(3,7,9,1,4,6,8,2,5)));
- }
- function defaultTemplate(){
- return array('page/line');
- }
- }
Add Comment
Please, Sign In to add comment