<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../src/excanvas.min.js">
</script><![endif]-->
<script language="javascript" type="text/javascript" src="../src/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="../src/jquery.jqplot.min.js"></script>
<link rel="stylesheet" type="text/css" href="../src/jquery.jqplot.min.css" />
<script class="code" type="text/javascript">
$(document).ready(function(){
var plot1 = $.jqplot ('chart1', [[3,7,9,1,4,6,8,2,5]]);
});
</script>
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');
}
}
$(document).ready(function(){
var plot2 = $.jqplot ('chart2', [[3,7,9,1,4,6,8,2,5]], {
// Give the plot a title.
title: 'Plot With Options',
// You can specify options for all axes on the plot at once with
// the axesDefaults object. Here, we're using a canvas renderer
// to draw the axis label which allows rotated text.
axesDefaults: {
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
},
// An axes object holds options for all axes.
// Allowable axes are xaxis, x2axis, yaxis, y2axis, y3axis, ...
// Up to 9 y axes are supported.
axes: {
// options for each axis are specified in seperate option objects.
xaxis: {
label: "X Axis",
// Turn off "padding". This will allow data point to lie on the
// edges of the grid. Default padding is 1.2 and will keep all
// points inside the bounds of the grid.
pad: 0
},
yaxis: {
label: "Y Axis"
}
}
});
});
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->api->template->append('js_include','<script type="text/javascript"
src="./atk4-addons/sterling/jqplot/templates/js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>'."\n");
$this->api->template->append('js_include','<script type="text/javascript"
src="./atk4-addons/sterling/jqplot/templates/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>'."\n");
$this->js()->_load('jqplot_helper');
$chart2 = $p->add('jqplot', null, 'chart2');
$chart2->setSeries(array(array(3,7,9,1,4,6,8,2,5)));
$chart2->set('title','Plot With Options');
$chart2->set('axesDefaults',array('labelRenderer'=>'CanvasAxisLabelRenderer'));
$chart2->set('axes',array(
'xaxis'=>array('label'=>'X Axis','pad'=>0),
'yaxis'=>array('label'=>'Y Axis')
)
);
}
function defaultTemplate(){
return array('page/line');
}
}
$(document).ready(function(){
// Some simple loops to build up data arrays.
var cosPoints = [];
for (var i=0; i<2*Math.PI; i+=0.4){
cosPoints.push([i, Math.cos(i)]);
}
var sinPoints = [];
for (var i=0; i<2*Math.PI; i+=0.4){
sinPoints.push([i, 2*Math.sin(i-.8)]);
}
var powPoints1 = [];
for (var i=0; i<2*Math.PI; i+=0.4) {
powPoints1.push([i, 2.5 + Math.pow(i/4, 2)]);
}
var powPoints2 = [];
for (var i=0; i<2*Math.PI; i+=0.4) {
powPoints2.push([i, -2.5 - Math.pow(i/4, 2)]);
}
var plot3 = $.jqplot('chart3', [cosPoints, sinPoints, powPoints1, powPoints2],
{
title:'Line Style Options',
// Series options are specified as an array of objects, one object
// for each series.
series:[
{
// Change our line width and use a diamond shaped marker.
lineWidth:2,
markerOptions: { style:'dimaond' }
},
{
// Don't show a line, just show markers.
// Make the markers 7 pixels with an 'x' style
showLine:false,
markerOptions: { size: 7, style:"x" }
},
{
// Use (open) circlular markers.
markerOptions: { style:"circle" }
},
{
// Use a thicker, 5 pixel line and 10 pixel
// filled square markers.
lineWidth:5,
markerOptions: { style:"filledSquare", size:10 }
}
]
}
);
});
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->api->template->append('js_include','<script type="text/javascript"
src="./atk4-addons/sterling/jqplot/templates/js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>'."\n");
$this->api->template->append('js_include','<script type="text/javascript"
src="./atk4-addons/sterling/jqplot/templates/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>'."\n");
$this->js()->_load('jqplot_helper');
for ($i=0; $i<2*M_PI;$i=$i+0.4) {
$cosPoints[]=array($i, cos($i));
}
for ($i=0; $i<2*M_PI;$i=$i+0.4) {
$sinPoints[]=array($i, 2*sin($i-.8));
}
for ($i=0; $i<2*M_PI;$i=$i+0.4) {
$powPoints1[]=array($i, 2.5+pow($i/4,2));
}
for ($i=0; $i<2*M_PI;$i=$i+0.4) {
$powPoints2[]=array($i, -2.5-pow($i/4,2));
}
$chart3 = $p->add('jqplot', null, 'chart3');
$chart3->setSeries(array($cosPoints, $sinPoints, $powPoints1, $powPoints2));
$chart3->set('title','Line Style Options');
$chart3->set('series',array(array('lineWidth'=>2,'markerOptions'=>array('style'=>'diamond')),
array('showLine'=>false, 'markerOptions'=>array('size'=>7, 'style'=>'x')),
array('markerOptions'=>array('style'=>'circle')),
array('lineWidth'=>5,'markerOptions'=>array('size'=>10, 'style'=>'filledSquare'))
)
);
$chart3->set('axes',array(
'xaxis'=>array('min'=>-1,'max'=>7, 'tickInterval'=>1),
'yaxis'=>array('min'=>-6, 'max'=>6)
)
);
}
function defaultTemplate(){
return array('page/line');
}
}
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->api->template->append('js_include','<script type="text/javascript"
src="./atk4-addons/sterling/jqplot/templates/js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>'."\n");
$this->api->template->append('js_include','<script type="text/javascript"
src="./atk4-addons/sterling/jqplot/templates/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>'."\n");
$this->api->template->append('js_include','<script type="text/javascript"
src="./atk4-addons/sterling/jqplot/templates/js/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>'."\n");
$this->js()->_load('jqplot_helper');
$db=$this->api->db->dsql()->table('driver d')
->field('d.driver')
->field('d.points')
->where('d.year',2011)
->order('d.points desc')
->do_getAll();
foreach ($db as $row) {
if (is_array($row)) {
$dbdata[] = array($row[0],floatval($row[1]));
}
}
$chart4 = $p->add('jqplot', null, 'chart4');
$chart4->setSeries(array($dbdata));
$chart4->set('title','Formula One - 2011 Drivers Results');
$chart4->set('axes',array(
'xaxis'=>array('renderer'=>'CategoryAxisRenderer'),
)
);
}
function defaultTemplate(){
return array('page/line');
}
}