I'm having a trouble displaying intraday stock market info.
I get the data from my data base, with the date and the value of the stock using a JDBCXYDataset, and it works fine.
Here in Brazil, the market opens at 9:00AM and closes at 6:00PM, and I get the data each 15 minutes.
When I plot a xylinechart, between the days, the graph has a "gap", showing a straight line.
I'm trying to use SegmentedTimeline, but I can't get it to work.
Here's what I'm doing:
Get the JDBCXYDataset from my database, basically 1 column with the date, and 2 more with data from a stock and then I create a JFreeChart.
Then I'm getting the plot from the jfchart, creating a new DateAxis, setting the range based on the x axis value, and then use this code to set the Timeline:
Code: Select all
public static SegmentedTimeline newFifteenMinuteTimeline() {
SegmentedTimeline timeline = new SegmentedTimeline(SegmentedTimeline.FIFTEEN_MINUTE_SEGMENT_SIZE, 36, 60);
timeline.setStartTime(
timeline.FIRST_MONDAY_AFTER_1900 + (36 * timeline.getSegmentSize()) - TimeZone.getDefault().getDSTSavings()
);
timeline.setBaseTimeline(timeline.newMondayThroughFridayTimeline());
return timeline;
}
Hope you can help me!
Thanks in advance!
William