Time Series Chart with Vertical Bar Chart

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

Time Series Chart with Vertical Bar Chart

Post by Samiul » Mon Sep 02, 2002 11:18 am

Hi !!
I have a stock feed coming at an interval of every 5-10 seconds (not fixed) from the Stock Exchange. This feed contains data like "Last Trade Time", "Last Trade Price", "Volume of Transactions" etc for each scrip.

From this I have to plot two graphs for each scrip---

1. A "Time Series Chart" with the "Last Trade Time" along x-axis and "Last Trade Price" along y-axis. The Time Series Chart uses XYDataset.
2. A "Vertical Bar Chart" with the "Volume".

The conditions are:
1. The two graphs should be one below the other (I am not sure whether it should be called combined/overlaid plot).
2. Since all three parameters come at the same time in one single feed, I want that the new values in both the Time Series Chart and the Vertical Bar Chart be plotted at the same instant from the data that has come in.

I have been able to do the dynamic Time Series Chart without the Vertical Bar Chart without any problems.

The questions that I have are:
1. Is it possible to implement what I have in mind?
2. If yes, then whether I should go in for a combined or a overlaid plot or what?
3. Whether I should go in for a CategoryDataset or an IntervalDataset for the Vertical Bar Chart?
4. I have to draw the vertical bars of only one scrip with the values as and when they arrive. So, how many categories should I have, in case I have to go in for a CategoryDataset?

P.S.---David, if u're reading this, plz rply since u didn't reply when I mailed u. Anyway, I solved that problem I had mentioned in the mail :))

Someone, plz help me with this problem, if it can be called so.

David Gilbert

Re: Time Series Chart with Vertical Bar Chart

Post by David Gilbert » Tue Sep 03, 2002 4:10 pm

Samiul wrote:
> 1. Is it possible to implement what I have in mind?

Yes.

> 2. If yes, then whether I should go in for a combined or a
> overlaid plot or what?

See the PriceVolumeDemo.java file in the com.jrefinery.chart.demo package. It is a CombinedXYPlot.

> 3. Whether I should go in for a CategoryDataset or an
> IntervalDataset for the Vertical Bar Chart?

You have to use IntervalXYDataset to be able to combine with a time series chart.

> 4. I have to draw the vertical bars of only one scrip with
> the values as and when they arrive. So, how many categories
> should I have, in case I have to go in for a CategoryDataset?

Not applicable.

Regards,

DG.

Samiul

Re: Time Series Chart with Vertical Bar Chart

Post by Samiul » Wed Sep 04, 2002 5:41 am

Thanx a lot, David !!!! I'll definitely try it out and get back to you.

Samiul

Re: Time Series Chart with Vertical Bar Chart

Post by Samiul » Wed Sep 04, 2002 10:33 am

Thanx David !!! The thing worked :)) However, there are some new problems that I am facing with the combined chart-----

1. I am getting a "sun.pr.......bad path exception". I am downloading 0.9.3 with the hope that the problem is rectified in this new version.
2. The vertical grid lines are no longer appearing with the combined chart.
3. Autorange and Zoom are throwing Null Pointer Exception.

ChartPanel chartPanel = new ChartPanel(chart); //chart--->Combined Chart
chartPanel.autoRangeBoth();
chartPanel.setMouseZoomable(true);

I definitely need to have the AutoRange and Zoom functionalities. Can u help???

Locked