PHP is a scripting language. You can see PHP graphs only online (they have the advantage of being resizable). If you want to see a graph generated by a PHP file you built (before putting it on the net) you must have installed a specific application (there are many free applications of this type; for example XAMPP).
By moving the mouse you can read the coordinates of the points on the graph.
These files can be used by directing pupils to the addresses indicated in the document just mentioned.
The files plot the graphs of continuous functions; vertical segments may appear at points of discontinuity.
The documents all have the same structure (with the automatic resizing of a window containing all the points):
<html> <head> <?php # description for file user $dataPoints = array( array("x" => -150, "y" => 4), # ... the points array("x" => 400, "y" => 4) ); ?> <script> window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { # "Canvas" is an extension of HTML to make images dynamic in a script animationEnabled: true, title: { text: "title that will appear"}, data: [{ type: "line", markerSize: 7, # <- line or spline; size of the point dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?> }] }); chart.render(); } </script> </head> <body><center> <div id="chartContainer" style="height: 95%; width: 90%;"></div> <script src="http://macosa.dima.unige.it/handbook/min.js"></script> </center> </body> </html>
Some example: head (a spline) graph_A (line chart) histo_A (histogram) death_A (histogram) |x| (function) sin(1/x)*x (function) F (function)
Only a grid of horizontal lines is drawn automatically and the interval of the abscissas is chosen so as to contain all the points. See here to see how horizontal ranges have been chosen and axes have been plotted for the graphs of
See here how to draw other curves and more than one graph.
For functions: domain is [$a, $b], input is x$[$i], if you want a 'title' go to the bottom.
The names of usable functions [if in $a or $b you must use π, write PI()]:
abs(a) / |a| PI() / π sqrt(a) / square root of a pow(a,b) / a to the power b acos(a) / arc cosine of a exp(a) / exponential of a asin(a) / arc sine of a log(a) / log of a base e atan(a) / arc tangent of a sin(a) / sine of a atan2(a,b) / arc tangent of a/b tan(a) / tangent of a cos(a) / cosine of a |