A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
Altug Altintas
Post
by Altug Altintas » Thu Oct 10, 2002 3:46 pm
I developed a histogram graph by using Jfreechart. You can watch this graph from :
http://www.riskturk.com/chart/histogram.jpeg
As you see, i have got problem on X axis legend values (Category). Category values are like this (-1789, -1637). It seems long but there are no ways no cut this value
How can i solve this problem ? Any idea
Regards
Altug.
-
Dave Gilbert
Post
by Dave Gilbert » Thu Oct 10, 2002 5:05 pm
Hi Altug,
If I was creating histograms, I would use the vertical XY bar chart:
ChartFactory.createVerticalXYBarChart(...)
For this you need your data accessible via the IntervalXYDataset. In this dataset, you can specify start and end x-values for each item in the series.
What is required is some utility methods to take a set of data and create an IntervalXYDataset with definable 'buckets' for the histogram.
Regards,
DG.
-
Altug Altintas
Post
by Altug Altintas » Fri Oct 11, 2002 2:19 pm
Hi Dave
I did what u said. i use vertical XY bar chart and i wrote a class which is impements IntervalXYDataset . Everything seems ok but if you look at Histogram graph :
http://www.riskturk.com/chart/histogram2.jpeg
The x values are in date/hour format.
My x axis values must be in number format like 236, 1234 or 1234.
I tried to use ValueAxis class to solve this problem but i doesn't effect anything.
How can i solve this ?
Regards
Altug.
-
Altug Altintas
Post
by Altug Altintas » Mon Oct 14, 2002 11:30 am
I found the solution. The problem is in ChartFactory.createVerticalXYBarChart(...) method. It creates DateAxis obkject automatically. I changed it to NumberAxis object and then it was solved.
Regards
Altug.
-
Dave Gilbert
Post
by Dave Gilbert » Mon Oct 14, 2002 11:34 am
Hi Altug,
Glad you found it. I'm using the XY bar chart for price-volume charts, so that is why it uses a date axis by default. It is probably sensible to create another method createHistogram(...) in the ChartFactory class that sets the chart up with a number axis.
Regards,
DG
-
Altug Altintas
Post
by Altug Altintas » Mon Oct 14, 2002 11:42 am
Thanks for your help Dave
By the way if you want, i try to write a generic Histogram chart
Regards
Altug.
-
Dave Gilbert
Post
by Dave Gilbert » Mon Oct 14, 2002 11:44 am
That would be great.
Regards,
DG