from java.util import *
from org.jfree.chart import ChartFactory
from org.jfree.data.xy import DefaultHighLowDataset
from java.lang import Math
from jhplot import *
def createData(year, month, date):
calendar = Calendar.getInstance()
calendar.set(year, month - 1, date)
return calendar.getTime()
date = []; high = []; low = []; open = []; close = []; volume = []
calendar = Calendar.getInstance();
calendar.set(2008, 5, 1)
for i in range(15): # fill data
date.append(createData(2008, 8, i + 1))
high.append(30 + Math.round(10) + (Math.random() * 20.0))
low.append(30 + Math.round(10) + (Math.random() * 20.0))
open.append(10 + Math.round(10) + (Math.random() * 20.0))
close.append(10 + Math.round(10) + (Math.random() * 20.0))
volume.append(10.0 + (Math.random() * 20.0))
data = DefaultHighLowDataset("",date,high,low,open,close,volume)
chart=ChartFactory.createCandlestickChart("Candlestick","Time","Price",data,False)
c1=HPlotChart(chart); c1.visible()
Ads help maintain this website.