MovingAverage and HiLowPlot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Takeshi Murai

MovingAverage and HiLowPlot

Post by Takeshi Murai » Mon May 28, 2001 10:19 am

Hi,

I am trying to create stock chart using HiLowPlot.
I would like to draw some MovingAverage plot on
same chart and same axis with MovingAveragePlotFitAlgorithm.
But I can't...

Probrems followings:
- I can't draw HiLowPlot and MovingAverage XYPlot on same chart.
- I can't use MovingAveragePlotFitAlgorithm for XYDataSource
that grouped every 4 elements (Hi/Low/Open/Close).

Can anyone help?

Regards,
Murai

David Gilbert

RE: MovingAverage and HiLowPlot

Post by David Gilbert » Wed May 30, 2001 12:29 am

Hi Murai,

The two developers that created the high-low-open-close plotting code and the moving average code were working independently, and so the two things don't fit together properly yet.

Tonight I took at look at the code to see if there is a quick way to resolve the problem. Unfortunately, the changes required are fairly large so I don't have anything working yet.

So far I have amended the HiLowPlot class (which I plan to rename HighLowPlot for consistency) to work with a new datasource (HighLowDataSource.java) which is an extension of the XYDataSource interface. I think this is cleaner than the original approach. If you look in the CVS repository on SourceForge (http://sourceforge.net/projects/jfreechart) you can see the changes I have made. Now a HighLowDataSource can be used to create a HighLowPlot, or just a plain XYPlot.

Next, I thought I'd amend the moving average code - however, that's going to take some thinking about. I like the concept of applying an algorithm to an XYDataSource to create a new set of data...but I'd like to improve the implementation so that the source data is not copied but just "wrapped". I might combine the changes with some ideas I have for implementing a new TimeSeries class along with some dynamic data sources based on collections of TimeSeries. Sorry if this sounds confusing - it's just ideas at the moment...

Regards,

DG.

Takeshi Murai

RE: MovingAverage and HiLowPlot

Post by Takeshi Murai » Wed May 30, 2001 5:47 am

Hi David,

It seems so good. But, some probrems remained.
Auto range has not working on HiLowDataSource.getYValue().
a y-value obtained from getHighValue() is higher than a highest
y-value obtained from getYValue(). The lowest is too.
DataSources class is needed to amend together.

But...
Sorry, I have created a custom plot class that draw HiLowOpenClose
lines and MovingAverage lines. (It's not elegant...)

I expect that data sources, plots and charts will get more multiple connectivity.

Regards,
Murai

Locked