Rev | Line | |
---|
[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | // Example of a stock chart |
---|
| 3 | require_once ('jpgraph/jpgraph.php'); |
---|
| 4 | require_once ('jpgraph/jpgraph_stock.php'); |
---|
| 5 | |
---|
| 6 | // Data must be in the format : open,close,min,max,median |
---|
| 7 | $datay = array( |
---|
| 8 | 34,42,27,45,36, |
---|
| 9 | 55,25,14,59,40, |
---|
| 10 | 15,40,12,47,23, |
---|
| 11 | 62,38,25,65,57, |
---|
| 12 | 38,49,32,64,45); |
---|
| 13 | |
---|
| 14 | // Setup a simple graph |
---|
| 15 | $graph = new Graph(300,200); |
---|
| 16 | $graph->SetScale('textlin'); |
---|
| 17 | $graph->SetMarginColor('lightblue'); |
---|
| 18 | $graph->title->Set('Box Stock chart example'); |
---|
| 19 | |
---|
| 20 | // Create a new stock plot |
---|
| 21 | $p1 = new BoxPlot($datay); |
---|
| 22 | |
---|
| 23 | // Width of the bars (in pixels) |
---|
| 24 | $p1->SetWidth(9); |
---|
| 25 | |
---|
| 26 | // Uncomment the following line to hide the horizontal end lines |
---|
| 27 | //$p1->HideEndLines(); |
---|
| 28 | |
---|
| 29 | // Add the plot to the graph and send it back to the browser |
---|
| 30 | $graph->Add($p1); |
---|
| 31 | $graph->Stroke(); |
---|
| 32 | |
---|
| 33 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.