views:

477

answers:

1

hi,

I'm currently working on a financial alerts application , and for the client interface I've decided to use JFreeChart. However as I'm new to it ,there are some important things that I can't figure about the ohlc charts :

-I'd like to be able to put in a chart only a limited number of bars (let's say 300) and after this number is reached the oldest bars to slide out of the chart .

-I've noticed that if for a period of time there are no bars , the domain axe still advances. For example ,if the begining time is 12:00 and I have a bar for an hour , the first bar will be for 12:00-13:00 , the next will be for 13:00-14:00, but if the next update that I get is at 17:38 then the next bar should be for the 17:00-18:00 interval . I'd like to know how to put the 17:00-18:00 bar next to the 13:00-14:00 bar without the x to advance for the 4 hours between.

-Is it possible to write my own mouse events for this kind of chart ?

Any suggestion or reference is welcomed ! Thank's

+1  A: 

You could try creating your own implementation of org.jfree.chart.axis.SegmentedTimeline and then use the following from org.jfree.chart.ChartFactory:

ChartFactory.createHighLowChart(java.lang.String title,
                                java.lang.String timeAxisLabel,
                                java.lang.String valueAxisLabel,
                                OHLCDataset dataset,
                                Timeline timeline,
                                boolean legend)
jt
could you show me a snipet of code to see how to manipulate a segmented timeline ?