SurveyResultsDemo3

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
luis_esru
Posts: 42
Joined: Tue Jan 20, 2004 6:40 pm
Location: Glasgow
Contact:

SurveyResultsDemo3

Post by luis_esru » Mon Feb 16, 2004 1:13 pm

David

I would like to include the labels outside, close to the end of the bars and centered. How do I do it with the following code,

ItemLabelPosition position = new ItemLabelPosition(
ItemLabelAnchor.INSIDE3, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, 0.0);

Note: I’m using horizontal bars.

Rgds
Luis
University of Strathclyde in Glasgow
ESRU
luis@esru.strath.ac.uk

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Feb 17, 2004 11:38 am

The first argument (an ItemLabelAnchor) controls the general location of the label relative to the bars. The numbers roughly correspond to the hours on a clockface, so you can use ItemLabelAnchor.OUTSIDE3 to get a label at the right of the bar, on the outside:

Code: Select all

ItemLabelPosition p = new ItemLabelPosition(
    ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT, TextAnchor.CENTER, 0.0
);
The next argument (a TextAnchor) controls which point on the label gets aligned to the item label anchor, and the final two arguments control the rotation of the label.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked