Hide weekend data in a 4 hour ohlc timeseries

Discussion about JFreeChart related to stockmarket charts.

Hide weekend data in a 4 hour ohlc timeseries

Postby reenotherhino » Wed Apr 18, 2012 5:48 pm

I have a ohlc financial chart which updates every 4 hours with a new ohlc bar and removes the oldest bar from the series. My question is this, how do I hide the blank spaces left over the weekend time periods. :roll:

OHLCSeries series0 = new OHLCSeries("EURUSD "+legendTitle);
NumberAxis rangeAxis0 = new NumberAxis("EURUSD "+legendTitle);
XYPlot subplot0 = new XYPlot(this.datasets[0], null, rangeAxis0, new CandlestickRenderer());
CandlestickRenderer r0 = new CandlestickRenderer();
XYLineAndShapeRenderer cRender0 = new XYLineAndShapeRenderer(true,true);
subplot0.setRenderer(1, cRender0);
Posts: 1
Joined: Wed Apr 18, 2012 5:42 pm

Re: Hide weekend data in a 4 hour ohlc timeseries

Postby russdb » Mon Jun 18, 2012 3:50 pm

I'm having the same issue. Big Problem. Have you found a solution.

I'm using Forex Data. It's a pain because the Forex Market isn't open during the weekends and JFreeChart is showing time periods for the weekends when there's no trading.

The issue is to do with the RegularTimePeriod. I think that JFreeChart automatically increments the date by a specified time period. But the flaw with this method is that it doesn't exclude periods of which there is no data for.

Sending the word out, if anyone else is reading this I'm anxious for a response for a workaround.
Posts: 3
Joined: Thu Jun 14, 2012 5:48 pm

Re: Hide weekend data in a 4 hour ohlc timeseries

Postby robthewolf » Mon Jun 25, 2012 9:23 am

you need to use a segmented time line ( I would search google for examples )
here is something simple

Code: Select all
SegmentedTimeline timeline = SegmentedTimeline.newMondayThroughFridayTimeline();
((DateAxis) chart.getXYPlot().getDomainAxis()).setTimeline(timeline);
Posts: 2
Joined: Mon Jun 25, 2012 7:58 am

Return to JFreeChart - Stockmarket

Who is online

Users browsing this forum: No registered users and 4 guests