| 1 |
lars |
1 |
<style type="text/css">
|
|
|
2 |
<!--
|
|
|
3 |
A:link {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
4 |
A:visited {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: none; color: #0000ff}
|
|
|
5 |
A:hover {font-family: helvetica, arial, geneva, sans-serif; font-size: x-small; text-decoration: underline; color: #FF0000}
|
|
|
6 |
th {font-family: helvetica, arial; color : blue; font-size:85%; background : lightgrey; border-right:black solid 1pt; border-bottom:black solid 1pt;}
|
|
|
7 |
//-->
|
|
|
8 |
</style><hr><a name="_C_STOCKPLOT"><div style="background-color:yellow;font-family:courier new;"></a>CLASS <b>StockPlot</b> EXTENDS <a href="Plot .html#_C_PLOT " style="font-face:arial;font-weight:bold;">Plot </a></div>
|
|
|
9 |
<i>(Defined in: jpgraph_stock.php : 15)</i><table border=1><tr><td> <a href="StockPlot.html" style="font-family:arial;font-weight:bold;color:darkblue;">StockPlot</a> </td><td> <a href="Plot .html" style="font-family:arial;font-weight:bold;color:darkblue;">Plot </a> </td></tr><tr><td valign=top> <a href="StockPlot.html#_STOCKPLOT_HIDEENDLINES">HideEndLines()</a> <br>
|
|
|
10 |
<a href="StockPlot.html#_STOCKPLOT_SETCOLOR">SetColor()</a> <br>
|
|
|
11 |
<a href="StockPlot.html#_STOCKPLOT_SETWIDTH">SetWidth()</a> <br>
|
|
|
12 |
<a href="StockPlot.html#_STOCKPLOT_STOCKPLOT">StockPlot()</a> <br>
|
|
|
13 |
</td><td valign=top> </td></tr></table> <p><div style="font-weight:bold;font-family:arial;font-size:100%;">Class usage and Overview</div>Create a stock chart graph, aka Candle-chart, aka Box-graph.
|
|
|
14 |
Each data point is represented by four values
|
|
|
15 |
(open,close,min,max)
|
|
|
16 |
|
|
|
17 |
<p>
|
|
|
18 |
<hr><span style="font-family:arial;font-size:120%;font-weight:bold;">Class Methods</span><hr><p>
|
|
|
19 |
<p> <p> <span style='font-size:110%;'><a name="_STOCKPLOT_HIDEENDLINES"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
20 |
function HideEndLines($aHide)</font>
|
|
|
21 |
</b></div></a></span>
|
|
|
22 |
|
|
|
23 |
<span style='font-family:arial;font-size:90%;'><i>Show horizontal mark lines at the end of min/max lines</i></span><p>
|
|
|
24 |
|
|
|
25 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
26 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
27 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
28 |
$aHide</font>
|
|
|
29 |
|
|
|
30 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
31 |
true</font>
|
|
|
32 |
</td><td>Flag true=show end lines</td></tr>
|
|
|
33 |
</table>
|
|
|
34 |
|
|
|
35 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Show horizontal mark lines at the end of min/max lines. This is enabled by default. <br>
|
|
|
36 |
|
|
|
37 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
38 |
$stock->HideEndLines();</font>
|
|
|
39 |
</span><br>
|
|
|
40 |
<p>
|
|
|
41 |
<p> <p> <span style='font-size:110%;'><a name="_STOCKPLOT_SETCOLOR"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
42 |
function SetColor($aColor,$aColor1,$aColor2,$aColor3)</font>
|
|
|
43 |
</b></div></a></span>
|
|
|
44 |
|
|
|
45 |
<span style='font-family:arial;font-size:90%;'><i>Specify colors for the stock plot</i></span><p>
|
|
|
46 |
|
|
|
47 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
48 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
49 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
50 |
$aColor</font>
|
|
|
51 |
|
|
|
52 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Line color for positive bars</td></tr>
|
|
|
53 |
|
|
|
54 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
55 |
$aColor1</font>
|
|
|
56 |
|
|
|
57 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
58 |
'white'</font>
|
|
|
59 |
</td><td>Fill color for positive bars</td></tr>
|
|
|
60 |
|
|
|
61 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
62 |
$aColor2</font>
|
|
|
63 |
|
|
|
64 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
65 |
'darkred'</font>
|
|
|
66 |
</td><td>Line color for negative bars</td></tr>
|
|
|
67 |
|
|
|
68 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
69 |
$aColor3</font>
|
|
|
70 |
|
|
|
71 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
72 |
'darkred'</font>
|
|
|
73 |
</td><td>Fill color for negative bars</td></tr>
|
|
|
74 |
</table>
|
|
|
75 |
|
|
|
76 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify the colros for a stock chart. A positive bar is defined as a bar where close > open. A negative bar is defined as a bar where close < open.
|
|
|
77 |
|
|
|
78 |
The positive line color is always used for the min/max lines.
|
|
|
79 |
|
|
|
80 |
By default positve colors are black and white. Negative colors are 'red' and 'red'.
|
|
|
81 |
<br>
|
|
|
82 |
|
|
|
83 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
84 |
$stockplot->SetColor('black','white','red','red');</font>
|
|
|
85 |
</span><br>
|
|
|
86 |
<p>
|
|
|
87 |
<p> <p> <span style='font-size:110%;'><a name="_STOCKPLOT_SETWIDTH"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
88 |
function SetWidth($aWidth)</font>
|
|
|
89 |
</b></div></a></span>
|
|
|
90 |
|
|
|
91 |
<span style='font-family:arial;font-size:90%;'><i>Specify width for stock bars in pixels</i></span><p>
|
|
|
92 |
|
|
|
93 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
94 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
95 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
96 |
$aWidth</font>
|
|
|
97 |
|
|
|
98 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Width in pixels</td></tr>
|
|
|
99 |
</table>
|
|
|
100 |
|
|
|
101 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Specify width for stock bars in pixels <br>
|
|
|
102 |
|
|
|
103 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
104 |
$stockplot->SetWidth(8);</font>
|
|
|
105 |
</span><br>
|
|
|
106 |
<p>
|
|
|
107 |
<p> <p> <span style='font-size:110%;'><a name="_STOCKPLOT_STOCKPLOT"><div style="border-top:solid black 2pt;background-color:lightblue;font-family:courier new;font-size:90%;font-weight:bold;"><b><font color="#000000">
|
|
|
108 |
function StockPlot(&$datay,$datax)</font>
|
|
|
109 |
</b></div></a></span>
|
|
|
110 |
|
|
|
111 |
<span style='font-family:arial;font-size:90%;'><i>Constructor for Stock plots</i></span><p>
|
|
|
112 |
|
|
|
113 |
<table cellspacing=0 style='border:black solid 1pt;' width=100%>
|
|
|
114 |
<tr><th width=25%>Argument</th><th width=15%>Default</th><th width=60%>Description</th></tr>
|
|
|
115 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
116 |
&$datay</font>
|
|
|
117 |
|
|
|
118 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'> </td><td>Y data array</td></tr>
|
|
|
119 |
|
|
|
120 |
<tr><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
121 |
$datax</font>
|
|
|
122 |
|
|
|
123 |
</td><td style='border-right:black solid 1pt;font-family:courier;font-size:90%;font-weight:bold;'><font color="#000000">
|
|
|
124 |
false</font>
|
|
|
125 |
</td><td>X data array</td></tr>
|
|
|
126 |
</table>
|
|
|
127 |
|
|
|
128 |
<div style="font-weight:bold;font-family:arial;font-size:85%;">Description</div>Create a new Stock data plot. Each data value consists of 4 data points. (open,close,min,max)
|
|
|
129 |
|
|
|
130 |
If the $ydata isn't an even number of data quadruples an error message will result. <br>
|
|
|
131 |
|
|
|
132 |
<div style="font-weight:bold;font-family:arial;font-size:85%;"><p>Example</div><span style="font-family:courier;font-size:85%;"><font color="#000000">
|
|
|
133 |
$ydata = array( .... )
<br />$stockplot = new StockPlot($ydata);
<br /></font>
|
|
|
134 |
</span><br>
|
|
|
135 |
<p> <hr> <p>
|