Left justify multi line label on Bar Chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
svenn
Posts: 5
Joined: Tue Sep 28, 2010 11:51 pm
antibot: No, of course not.

Left justify multi line label on Bar Chart

Post by svenn » Mon Oct 04, 2010 1:32 am

I've set the following values in my bar chart so the y axis label values will have two lines

categoryAxis.setMaximumCategoryLabelWidthRatio(25.0f);
categoryAxis.setMaximumCategoryLabelLines(2);

Now the problem I have is the default behavior when you do this is for the two values to be centered. I would like the two values to be left justified.

How would I go about doing this? I tried creating a CategoryLabelPosition object and setting setCategoryLabelPositions but I could not get it to work. I expect I’m not setting the correct values for my CategoryLabelPosition object but I cannot figure out what I should be setting it too.

I tried this for example

CategoryLabelPosition leftPositionSpec = new CategoryLabelPosition(
RectangleAnchor.LEFT,
TextBlockAnchor.CENTER_LEFT,
TextAnchor.CENTER_LEFT,
90.0,
CategoryLabelWidthType.RANGE,
0.2f);

categoryAxis.setCategoryLabelPositions(new CategoryLabelPositions(
new CategoryLabelPosition(), new CategoryLabelPosition(),
leftPositionSpec, new CategoryLabelPosition()))

Locked