Initial commit
This commit is contained in:
252
OLD/jpowered/demo/examples/requestParams.htm
Normal file
252
OLD/jpowered/demo/examples/requestParams.htm
Normal file
@@ -0,0 +1,252 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Advanced Graphs and Charts for PHP</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<link rel=STYLESHEET type="text/css" href="../../images/960.css" />
|
||||
<link rel=STYLESHEET type="text/css" href="../../images/jpprodstyle.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Title area -->
|
||||
<div class='container_12 header'>
|
||||
<div class='grid_4'>
|
||||
<a href='http://www.jpowered.com'><img style='border-width: 0px;' src='../../images/jpowered.gif' width='270' height='60' align='left' alt='JPowered.com' /></a>
|
||||
</div>
|
||||
<div class='grid_8 omega product_title'>
|
||||
<h1>Advanced Graphs and Charts for PHP</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- top menu bar -->
|
||||
<div class='container_12'>
|
||||
<div class='grid_12 innm'>
|
||||
<ul>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/">Graph Home</a> </li>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/buy-now.htm" title="Pricing Options and obtaining License keys">Pricing / License Options</a> </li>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/demos/" title="View the Online Demos here">Online Demos</a> </li>
|
||||
<li> <a href="../../documentation/index.htm">Documentation</a> </li>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/tutorials/" title="Online Tutorials">Tutorials</a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- main content -->
|
||||
<div class='container_12 main_content'>
|
||||
|
||||
<div class='grid_9'>
|
||||
|
||||
<h2>Utilising Request Parameters</h2>
|
||||
|
||||
<p>In this example we again use the included data function method but
|
||||
this time we pass a request parameter through on the IMG tag. The data function
|
||||
will then produce the graph data based on the value of the request parameter.</p>
|
||||
|
||||
<p>This method has a variety of uses including displaying graph data dynamically
|
||||
based upon user form selection.</p>
|
||||
|
||||
<img src="../../graph/vertical-cylinder-graph.php?
|
||||
datascript=../demo/examples/data/dataFunctionParams.php&
|
||||
config=../demo/examples/data/configFile.txt&
|
||||
customParam=8"
|
||||
width=700
|
||||
height=400 />
|
||||
<p> </p>
|
||||
|
||||
<p>Here is the IMG tag which invokes the graphing software which dynamically creates the
|
||||
graph image at page load time.</p>
|
||||
|
||||
<textarea class="jpcodeblock" style="width: 600px;">
|
||||
<img src="../../graph/vertical-cylinder-graph.php?
|
||||
datascript=../demo/examples/data/dataFunctionParams.php&
|
||||
config=../demo/examples/data/configFile.txt&
|
||||
customParam=8"
|
||||
width=700
|
||||
height=400 />
|
||||
</textarea>
|
||||
|
||||
<p>Note the extra parameter 'customParam=8' on the IMG tag URL. This is
|
||||
used by the data function to create the data for the chart.</p>
|
||||
|
||||
<p>Here we tell the software to load the configuration options from the
|
||||
file <a href='./data/configFile.txt'>configFile.txt</a> and include the data
|
||||
function dataFunctionParams.php (code below)</p>
|
||||
|
||||
<textarea class="jpcodeblock" style="width: 600px; height: 400px;">
|
||||
/*
|
||||
* The graphing software will look for a function named datascript()
|
||||
* at runtime. If found the graph will call this to acquire the
|
||||
* graph data.
|
||||
*/
|
||||
function datascript () {
|
||||
|
||||
/*
|
||||
* Create the Data Array
|
||||
*
|
||||
* Here we demonstrate how the graphs can be used to display
|
||||
* data based upon the value of request parameters.
|
||||
*
|
||||
* In this trivial example we use the value of a request
|
||||
* parameter to generate the data values.
|
||||
*
|
||||
*/
|
||||
$dataArray = array('series1' => array(50*$_REQUEST['customParam'], 75*$_REQUEST['customParam'], 125*$_REQUEST['customParam'], 430*$_REQUEST['customParam']),
|
||||
'series2' => array(200*$_REQUEST['customParam'], 210*$_REQUEST['customParam'], 260*$_REQUEST['customParam'], 240*$_REQUEST['customParam']),
|
||||
'series3' => array(830*$_REQUEST['customParam'], 740*$_REQUEST['customParam'], 620*$_REQUEST['customParam'], 320*$_REQUEST['customParam']));
|
||||
|
||||
/*
|
||||
* Convert the data into the array format required
|
||||
* by the graphing software
|
||||
*
|
||||
* The format required is a one dimensional array
|
||||
* which contains a text for each line of data.
|
||||
*
|
||||
*/
|
||||
$dataLines = array();
|
||||
|
||||
/*
|
||||
* write out the data in the format required for the graphing software
|
||||
*/
|
||||
foreach ($dataArray['series1'] as $dataIndex => $dataValue)
|
||||
{
|
||||
$dataLines[] = 'data' . ($dataIndex+1) . 'series1: ' . $dataValue;
|
||||
}
|
||||
|
||||
foreach ($dataArray['series2'] as $dataIndex => $dataValue)
|
||||
{
|
||||
$dataLines[] = 'data' . ($dataIndex+1) . 'series2: ' . $dataValue;
|
||||
}
|
||||
|
||||
foreach ($dataArray['series3'] as $dataIndex => $dataValue)
|
||||
{
|
||||
$dataLines[] = 'data' . ($dataIndex+1) . 'series3: ' . $dataValue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* return the $dataLines array to the
|
||||
* graphing software
|
||||
*/
|
||||
return $dataLines;
|
||||
}
|
||||
|
||||
</textarea>
|
||||
|
||||
<p><strong>Note:</strong> if a closing PHP tag (?>)is added at the end
|
||||
of the data function file then it is vital that no characters appear
|
||||
after that tag. If even a space character exists then the graphing
|
||||
image will not be produced. It is recommend that the closing PHP tag is
|
||||
omitted.</p>
|
||||
|
||||
|
||||
<p><strong>Note:</strong> the URLs supplied for both the configuration and
|
||||
data are relative URLs. The URLs are relative to the location of the
|
||||
graphing software and NOT this page.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p>If the graph does not display then see the <a href="../../documentation/troubleShooting.htm">Troubleshooting guide</a> for details on how to resolve the problem.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<p> </p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class='grid_3'>
|
||||
|
||||
|
||||
<p><a href="../../index.htm">Package Index</a></p>
|
||||
<p><a href="../../documentation/index.htm">Documentation</a></p>
|
||||
<p><a href="../../documentation/troubleShooting.htm">Troubleshooting Guide</a></p>
|
||||
<p><a href="http://www.jpowered.com/support.htm">Support</a></p>
|
||||
|
||||
<h4>Examples</h4>
|
||||
<ul>
|
||||
<li><a href='../examples/dataFiles.htm'>Graphing Data from files</a></li>
|
||||
<li><a href='../examples/scripts.htm'>Data from external scripts</a></li>
|
||||
<li><a href='../examples/datafunction.htm'>Custom data function</a></li>
|
||||
<li><a href='../examples/requestParams.htm'>Utilising request parameters</a></li>
|
||||
<li><a href='../examples/database.htm'>Plotting data from a database</a></li>
|
||||
<li><a href='../examples/interface.htm'>Database interface scripts</a></li>
|
||||
<li><a href='../examples/multiScales.htm'>Multiple Scales, text and images</a></li>
|
||||
<li><a href='../examples/csvfile.htm'>Graphing CSV files</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
<h4>Basic Chart Styles</h4>
|
||||
<ul>
|
||||
<li><a href="../../demo/piechart/index.htm">Pie Charts</a></li>
|
||||
<li><a href="../../demo/xyscatter/index.htm">X-Y Scatter Graphs</a></li>
|
||||
<li><a href="../../demo/bubblechart/index.htm">Bubble Charts</a></li>
|
||||
<li><a href="../../demo/areagraph/index.htm">Area Graphs</a></li>
|
||||
<li><a href="../../demo/linegraph/index.htm">Line Graphs</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Bar Graphs</h4>
|
||||
<ul>
|
||||
<li><a href="../../demo/vbar/index.htm">Vertical Bar Graphs</a></li>
|
||||
<li><a href="../../demo/svbar/index.htm">Stacked Vertical Bar Graphs</a></li>
|
||||
<li><a href="../../demo/hbar/index.htm">Horizontal Bar Graphs</a></li>
|
||||
<li><a href="../../demo/shbar/index.htm">Stacked Horizontal Bar Graphs</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Cylinder Charts</h4>
|
||||
<ul>
|
||||
<li><a href="../../demo/cylinder-Vbar/index.htm">Vertical Cylinder Graphs</a></li>
|
||||
<li><a href="../../demo/cylinder-SVbar/index.htm">Stacked Vertical Cylinder Graphs</a></li>
|
||||
<li><a href="../../demo/cylinder-Hbar/index.htm">Horizontal Cylinder Graphs</a></li>
|
||||
<li><a href="../../demo/cylinder-SHbar/index.htm">Stacked Horizontal Cylinder Graphs</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Combination Charts</h4>
|
||||
<ul>
|
||||
<li><a href="../../demo/combi-Area-SVbar/index.htm">Area and Stacked Vertical Bar Graph</a></li>
|
||||
<li><a href="../../demo/combi-Area-Vbar/index.htm">Area and Vertical Bar Graph</a></li>
|
||||
<li><a href="../../demo/combi-Line-SVbar/index.htm">Line and Stacked Vertical Bar Graph</a></li>
|
||||
<li><a href="../../demo/combi-Line-Vbar/index.htm">Line and Vertical Bar Graph</a></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class='footer'>
|
||||
|
||||
<!-- bottom menu bar -->
|
||||
<div class='container_12'>
|
||||
<div class='grid_12 innm'>
|
||||
<ul>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/">Graph Home</a> </li>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/buy-now.htm" title="Pricing Options and obtaining License keys">Pricing / License Options</a> </li>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/demos/" title="View the Online Demos here">Online Demos</a> </li>
|
||||
<li> <a href="../../documentation/index.htm">Documentation</a> </li>
|
||||
<li> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/tutorials/" title="Online Tutorials">Tutorials</a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- footer -->
|
||||
<div class='container_12'>
|
||||
<div class="grid_12 mc">[<a href="http://www.jpowered.com/"> JPowered.com </a>] [<a href="http://www.jpowered.com/products.htm" title="More software components for web applications"> More Products </a>] [<a href="http://www.jpowered.com/support.htm" title="For Help and Support, contact us here">Support </a>]</div>
|
||||
<div class="grid_12 cprt">Copyright © 2011 - 2014 Neutron Solutions Limited - All rights reserved.</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user