Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » recompute chart label canvas
recompute chart label canvas [message #1063489] Thu, 13 June 2013 09:52 Go to next message
hage Mising name is currently offline hage Mising name
Messages: 67
Registered: September 2011
Member
Hi,

due to a to big amount of chars in my axis labels i recompute the labelstrings like this:

function beforeDrawAxisLabel( axis, label, icsc )
{

	value = label.getCaption().getValue();
	sb = new StringBuilder();
	if(value.contains(" ")){
		number = value.substring(0, value.indexOf(" "));
		try{
			Integer.parseInt(number);
			sb.append(number);		
		} catch (e){
			if(value.length() > 8){
				sb.append(value.substring(0, 8));
				sb.append("...");
			} else {
				sb.append(value);
			}
		}
	} else {
		if(sb.length() == 0){
			if(value.length() > 8){
				sb.append(value.substring(0, 8));
				sb.append("...");
			} else {
				sb.append(value);
			}
		}
	}
	label.getCaption().setValue(sb.toString().trim());
	label.getCaption().getFont().setRotation(0);
	axis.setLabel(label);
	
	
}


That reduces my input strings from "23 foooooooooooooooooooooooo" to "23", or "fooooooooooooooooooooo" to "fooooooo...".Nevertheless, the space reserved for the label is still that big, as the string (caption) still has its original length. That induces there are only a few labels visible, since their reserved space is pushing the others to a non-visible area. How can i tell the engine, to recompute the space reserved for that image.
I already set the rotation of the labels to 90, to preserve my chart from gettin' to far away from the left side of the page.

thx in advance,

hage
Re: recompute chart label canvas [message #1064132 is a reply to message #1063489] Mon, 17 June 2013 18:30 Go to previous message
Kristopher Clark is currently offline Kristopher Clark
Messages: 130
Registered: January 2013
Senior Member
You can change the insets in the chart UI so the space is reduced. Or if you want the chart engine to fit it for you then you could create an invisible table with the data being used in the chart and change the label data there, then use the table as the data source for your chart. I haven't tested it yet but I think that should do the trick so you don't have to change any of the insets yourself.
Previous Topic:birt (svg) chart to show in old browser (as IE 8)
Next Topic:Parameterized Query - Problem
Goto Forum:
  


Current Time: Thu Oct 23 14:32:58 GMT 2014

Powered by FUDForum. Page generated in 0.13381 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software