Add note (some text) to graph under the X-axis label

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

Add note (some text) to graph under the X-axis label

Post by Ram » Fri Aug 08, 2003 12:36 pm

Hi,

How to add note (some text) to graph under the X-axis label.

Thanks,
Ram

jsrana
Posts: 2
Joined: Fri Aug 08, 2003 4:00 pm
Location: New Jersey

Post by jsrana » Mon Aug 11, 2003 9:04 pm

Hi,

Use TextTitle class to add text anywhere on the graph. The following code will help:

TextTitle chartinfo = new TextTitle( "Chart Info" );
chartinfo.setPosition( TextTitle.BOTTOM ); // position the title below X axis
chartinfo.setHorizontalAlignment( TextTitle.LEFT ); // set the horizontal alignment
chart.addSubtitle( chartinfo ); // Here chart is the instance of JFreeChart

Similarly you may also add LegendTitle or ImageTitle.

Enjoy !!!
- Rana

Locked