Candlestick chart

Discussion about JFreeChart related to stockmarket charts.
Locked
bubbles
Posts: 5
Joined: Mon Jan 22, 2007 3:02 pm

Candlestick chart

Post by bubbles » Mon Jan 22, 2007 9:05 pm

hi
I am writting code for a program that takes from the user a certain date & a stock name & other info about this stock then the program gets the OHLC data for this specific data & plots its candlestick chart
so as you can see, the chart is a variable

so everything is setteled in the frame except for creating the HighLowDataset, then creating the candleStickChart (createCandlestickChart()), then creating the chartPanel & attaching it to the content pane

all this part is done together in a method called firePlot() & it will be called after the user enters the data & presses a certain button

my problem is that it only works perfect for the first time & it excellently plots the required data, but if the user requested another date & pressed the button it sometimes gets the data & plots it & sometimes gets the data & keeps the old plot, & if we are in the first case (gets the data & plots it) if I minimized the frame then restored it back the first plot is the one displayed as if other plots are plotted in a different layout on the first plot and if anything happens it simply erases it as if it is a white board :!: :!: :!:

can any one guess what is the problem? i spent 4 days trying to find out what's going wrong but I completely failed :cry:

develop
Posts: 296
Joined: Wed Mar 23, 2005 10:01 pm

Post by develop » Tue Jan 23, 2007 7:48 pm

are removing old plot before adding new one to chartPanel ?

also once you add chart to chartPanel. you need to force the repaint,

so if that chartPanel is on scrollpane try following

scrollpane.setVisible(false);
scrollpane.setVisible(true);

Hope this helps

Locked