DefaultHighLowDataset: filtering data

Discussion about JFreeChart related to stockmarket charts.
Locked
JGoodwin
Posts: 27
Joined: Thu Sep 06, 2007 3:19 am
Location: Boston USA

DefaultHighLowDataset: filtering data

Post by JGoodwin » Fri Nov 18, 2011 4:52 pm

I want to use DefaultHighLowDataset because I already have the relevant price and volume data in parallel straight arrays. However, my arrays have entries for non-trading days. Such entries have a legit Date, zero Volume, and NaN in the four price fields. DefaultHighLowDataset throws an exception on these days.

Is it spec that DefaultHighLowDataset throws for such days? if not, I'll dig into the exception more carefully.

My data arrays are used in my application and I need to keep the off-days in the list so indexing by day-counts works right. I could make a copy of the data, filtering out the off-days, and pass that to DefaultHighLowDataset.

But I wondered if there isn't some way to tell DefaultHighLowDataset to ignore off-days. The Date[] column is not part of my app, so I can modify that, so I tried setting it to null on off-days, but still DefaultHighLowDataset just throws.

(I don't want to use a Segmented timeline; I'm quite happy with having the off-days in the timeline and the chart; I just expect no OHLC or volume bars on those days.)

Thanks
JG

JGoodwin
Posts: 27
Joined: Thu Sep 06, 2007 3:19 am
Location: Boston USA

Rephrasing the question

Post by JGoodwin » Fri Nov 18, 2011 5:28 pm

Having studied the source code further, let me rephrase my question.

Suppose I tried to write my own class similar to DefaultHighLowDataset, but just storing the arrays I have, instead of copying them.

The rest of JFreechart -- all the drawing routines and what-not -- presumably assume that they can use any x-coordinate and get valid values back, and there is no way to signal them just to skip a certain x-coordinate. Right? So my idea of directly using arrays that have non-displayable rows is a no-hoper.

Secondly, does the rest of JFreechart actually use the accessors that return Numbers? I assume so, otherwise why would they be there? So there is no way to write a class that stores unwrapped doubles and longs in straight arrays, and avoid storing all those Number objects. (One could write the getters that return Numbers to cons up a new Number each time, which would be fine if the rest of JFreechart generally didn't call those getters.)

Locked