<?php require_once "../conf.php"; ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpChart - Basic Chart with Bar Renderer</title> </head> <body> <?php $pc = new C_PhpChartX(array(array(11, 9, 5, 12, 14), array(1, 4, 3, 2, 5)), 'basic_chart'); $pc->set_animate(true); $pc->set_title(array('text' => 'Basic Chart with Bar Renderer')); // $pc->set_series_default(array('renderer'=>'plugin::BarRenderer')); $pc->set_defaults(array('seriesDefaults' => array('renderer' => 'plugin::BarRenderer', 'rendererOptions' => array('barPadding' => 6, 'barMargin' => 40)), 'axesDefaults' => array('showTickMarks' => true, 'tickOptions' => array('formatString' => '%d')), 'stackSeries' => true)); $pc->add_plugins(array('highlighter', 'cursor')); $pc->draw(); ?> </body> </html>
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpChart - Area</title> </head> <body> <div><span>Moused Over: </span><span id="info1b">Nothing</span></div> <?php ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //example area 1 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $l2 = array(11, 9, 5, 12, 14); $l3 = array(4, 8, 5, 3, 6); $l4 = array(12, 6, 13, 11, 2); $pc = new C_PhpChartX(array($l2, $l3, $l4), 'area_1'); //set jqplot default options $pc->set_defaults(array('seriesDefaults' => array('fill' => true), 'showMarker' => true, 'stackSeries' => true)); $pc->set_xaxes(array('xaxis' => array('renderer' => 'plugin::CategoryAxisRenderer', 'ticks' => array('Mon', 'Tue', 'Wed', 'Thr', 'Fri')))); //Binding JavaScript $pc->bind_js('jqplotDataHighlight', array('series' => 'seriesIndex', 'point' => 'pointIndex', 'data' => 'data')); $pc->bind_js('jqplotDataUnhighlight', array('Nothing')); $pc->draw(400, 260); ?> </body> </html>
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>phpChart - Axis Label Chart</title> </head> <body> <?php $l1 = array(array(2011, 1200), array(2039, 1200)); $l2 = array(array(2011, 0), array(2039, 800)); $l3 = array(array(2011, 0), array(2039, 400)); $pc = new C_PhpChartX(array($l1, $l2, $l3), 'area_1'); $pc->add_plugins(array('canvasTextRenderer')); //set jqplot default options $pc->set_defaults(array('seriesDefaults' => array('fill' => true, 'fillToZero' => true, 'fillToValue' => 100, 'yaxis' => 'y2axis'), 'axesDefaults' => array('showTickMarks' => false, 'tickOptions' => array('formatString' => '%d')), 'stackSeries' => true)); //set grid properties $pc->set_grid(array('background' => '#ffffff', 'borderWidth' => 0, 'borderColor' => '#ffffff', 'shadow' => true, 'shadowWidth' => 10, 'shadowOffset' => 3, 'shadowDepth' => 3, 'shadowColor' => 'rgba(230, 230, 230, 0.07)')); //set legend properties $pc->set_legend(array('renderer' => 'plugin::EnhancedLegendRenderer', 'show' => true, 'location' => 's', 'placement' => 'outside', 'yoffset' => 30, 'rendererOptions' => array('numberRows' => 2), 'labels' => array('oil', 'renewables', 'wind and water'))); //set axes $pc->set_xaxes(array('xaxis' => array('borderWidth' => 2, 'borderColor' => '#999999', 'ticks' => array(2010, 2040), 'tickOptions' => array('showGridline' => false)), 'x2axis' => array('borderWidth' => 0, 'borderColor' => '#ffffff'))); $pc->set_yaxes(array('y2axis' => array('borderWidth' => 0, 'borderColor' => '#ffffff', 'autoscale' => true, 'min' => '0', 'max' => 3000, 'numberTicks' => 4, 'labelRenderer' => 'plugin::CanvasAxisLabelRenderer', 'label' => 'energy use'), 'yaxis' => array('borderWidth' => 2, 'borderColor' => '#999999'))); //add custom JS $pc->add_custom_js("\n\t\tvar r = area_1._width - area_1._gridPadding.left - 5; \n\t\tr = r+'px'; \n\t\t\$('.jqplot-y2axis-label').css({top:'10px', right:r});", "after"); $pc->draw(); ?> </body> </html>