Hide weekend data in a 4 hour ohlc timeseries

Discussion about JFreeChart related to stockmarket charts.
Locked
reenotherhino
Posts: 1
Joined: Wed Apr 18, 2012 5:42 pm
antibot: No, of course not.

Hide weekend data in a 4 hour ohlc timeseries

Post by 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);
rangeAxis0.setAutoRangeIncludesZero(false);
XYPlot subplot0 = new XYPlot(this.datasets[0], null, rangeAxis0, new CandlestickRenderer());
CandlestickRenderer r0 = new CandlestickRenderer();
subplot0.setRenderer(0,r0);
XYLineAndShapeRenderer cRender0 = new XYLineAndShapeRenderer(true,true);
subplot0.setRenderer(1, cRender0);
subplot0.setBackgroundPaint(Color.lightGray);
subplot0.setDomainGridlinePaint(Color.white);
subplot0.setRangeGridlinePaint(Color.white);

russdb
Posts: 3
Joined: Thu Jun 14, 2012 5:48 pm
antibot: No, of course not.

Re: Hide weekend data in a 4 hour ohlc timeseries

Post by 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.

robthewolf
Posts: 2
Joined: Mon Jun 25, 2012 7:58 am
antibot: No, of course not.

Re: Hide weekend data in a 4 hour ohlc timeseries

Post by 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);

Locked