CLASS
StockPlot EXTENDS
Plot
(Defined in: jpgraph_stock.php : 15) Class usage and Overview
Create a stock chart graph, aka Candle-chart, aka Box-graph.
Each data point is represented by four values
(open,close,min,max)
Class Methods
function HideEndLines($aHide)
Show horizontal mark lines at the end of min/max lines
Argument | Default | Description |
$aHide
|
true
| Flag true=show end lines |
Description
Show horizontal mark lines at the end of min/max lines. This is enabled by default.
$stock->HideEndLines();
function SetColor($aColor,$aColor1,$aColor2,$aColor3)
Specify colors for the stock plot
Argument | Default | Description |
$aColor
| | Line color for positive bars |
$aColor1
|
'white'
| Fill color for positive bars |
$aColor2
|
'darkred'
| Line color for negative bars |
$aColor3
|
'darkred'
| Fill color for negative bars |
Description
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.
The positive line color is always used for the min/max lines.
By default positve colors are black and white. Negative colors are 'red' and 'red'.
$stockplot->SetColor('black','white','red','red');
function SetWidth($aWidth)
Specify width for stock bars in pixels
Argument | Default | Description |
$aWidth
| | Width in pixels |
Description
Specify width for stock bars in pixels
$stockplot->SetWidth(8);
function StockPlot(&$datay,$datax)
Constructor for Stock plots
Argument | Default | Description |
&$datay
| | Y data array |
$datax
|
false
| X data array |
Description
Create a new Stock data plot. Each data value consists of 4 data points. (open,close,min,max)
If the $ydata isn't an even number of data quadruples an error message will result.
$ydata = array( .... )
$stockplot = new StockPlot($ydata);