XYchart extra data with chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
raffi100
Posts: 1
Joined: Wed Aug 07, 2013 7:30 pm
antibot: No, of course not.

XYchart extra data with chart

Post by raffi100 » Wed Aug 07, 2013 7:42 pm

Hi,

I am currently using the latest JFreeChart version 1.0.15. I would like to have some data presented on the bottom right of my graph. Unfortunately, I can only get the data to show up at the bottom of my graph, using the following code:

TextTitle statsText = new TextTitle("Overall Median = " + statistics.getSamplerMedian()
+ "\n Overall Average = " + statistics.getSamplerAverage()
+ "\n Overall Ninety-Fifth = " + statistics.getSamplerNinetyFifth()
+ "\n Overall Ninety-Ninth = " + statistics.getSamplerNinetyNinth());
statsText.setPosition(RectangleEdge.BOTTOM);
chart.addSubtitle(statsText);

Using RectangleEdge.BOTTOM puts a lot of text in the same area and clogs up the look of the graph. Preferably, I would like some of the data to be presented in the bottom right, as shown here:

Image

So opposed to having the overall stats on the bottom, I would like them positioned in the open area to the bottom right. Having it left justified would also be optimal. Any way to achieve this?


Thanks in advance!

P.S. I have searched for an answer to this problem on google, the forums, and javadoc. However, I'm not quite sure how to word what I'm looking for.

EDIT: I have found a way to bring the data to the bottom right corner of the graph through the following post:

http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=27968

Using statsText.setHorizontalAlignment(HorizontalAlignment.RIGHT); seemed to have almost cleared up my issue... The only two things I would like to change are getting the lines to be left justified and having the data on the same y-coordinates as the legend, and date that the test began. Currently, it looks like this:

Image

There is still space being allocated in the bottom center of the graph for the overall stats, even though they are now at the bottom right. I have tried removing the chart.setPosition(RectangleEdge.Bottom) and putting chart.setVerticalAlignment(VerticalAlignment.BOTTOM), but that makes it end up showing on the top right instead..

Locked