---Sherlock, Ric wrote:
> --Oleg Kobchenko wrote:
> > There is also filled/hollow candlesticks charts.
>
> I thought these would be quite easy to implement by combining
> a hilo plot and a floating bar plot, but ran in to a couple of issues.
>
>  A) The way the horizontal position of the bars and the hilo
> lines are calculated doesn't seem to be compatible so the
> bars are not centred on the lines except for the middle
> datapoint. There may be a way to force these to overlap?
>
>  B) The floating bar plot type forces the y range to include
> 0 which means that small changes in values a long way from 0
> don't show up well. Manually specifying the yrange, (eg.
> yrange 60 80) only affects the max value not the minimum.

Solved issue A, but there is still the problem with yrange.

load 'plot csv'
Dmarkf=: jpath '~system\examples\data\dm0396.txt'
data2=: |: _50{. 0". >1 2 3 4{"1 readcsv Dmarkf

'yrange 0 10' plot_candlestick data2-65

Here is an example of adding custom x labels:

lbls=: ;:^:_1 (8!:0 lbl) (<:lbl=.(>:i.10)*50%10)} 50#<'""'
('yrange 0 10;xlabel ',lbls) plot_candlestick data2-65

plot_candlestick=: 3 : 0
 ''plot_candlestick y
:
 hl=. 1 2{y
 oc=. 0 3{y
 oc=. (<./ , (] (|@:*"1) 0&> ,: 0&<)@:-/) oc
 ntics=. {:$hl
 pd 'reset'
 pd 'xrange ',": _0.5+0,ntics
 pd x
 pd 'color blue'
 pd 'type hilo'
 pd hl
 pd 'color white,blue'
 pd 'barwidth 0.4'
 pd 'type fbar'
 pd oc
 pd 'show'
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to