Line | |
---|
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 | // Setup URL target for image map
|
---|
24 | $p1->SetCSIMTargets(array('#1','#2','#3','#4','#5'));
|
---|
25 |
|
---|
26 | // Width of the bars (in pixels)
|
---|
27 | $p1->SetWidth(9);
|
---|
28 |
|
---|
29 | //$p1->SetCenter();
|
---|
30 | // Uncomment the following line to hide the horizontal end lines
|
---|
31 | //$p1->HideEndLines();
|
---|
32 |
|
---|
33 | // Add the plot to the graph and send it back to the browser
|
---|
34 | $graph->Add($p1);
|
---|
35 | $graph->StrokeCSIM();
|
---|
36 |
|
---|
37 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.