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
|
---|
| 7 | $datay = array(
|
---|
| 8 | 34,42,27,45,
|
---|
| 9 | 55,25,14,59,
|
---|
| 10 | 15,40,12,47,
|
---|
| 11 | 62,38,25,65,
|
---|
| 12 | 38,49,32,64);
|
---|
| 13 |
|
---|
| 14 | // Setup a simple graph
|
---|
| 15 | $graph = new Graph(300,200);
|
---|
| 16 | $graph->SetScale("textlin");
|
---|
| 17 | $graph->SetMarginColor('lightblue');
|
---|
| 18 | $graph->title->Set('Stockchart example');
|
---|
| 19 |
|
---|
| 20 | // Create a new stock plot
|
---|
| 21 | $p1 = new StockPlot($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.