Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Formatting value in Meter Chart legend
Formatting value in Meter Chart legend [message #654415] Tue, 15 February 2011 16:34 Go to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 141
Registered: July 2009
Senior Member
I have a meter chart and I have specified "Show Value" in the legend. The values in my case are some percentage that I would like to display in the form of nnn.nn%. However I cannot find anyplace in the GUI to specify a format for these values and since the value is computed by the specified aggregation function, I can't format in my own series script and display it as a string.
Can this be done or do I need to just not use this feature and put in some dynamic text under the chart to display the values?
Re: Formatting value in Meter Chart legend [message #654456 is a reply to message #654415] Tue, 15 February 2011 21:10 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Mike,

Can you put a script in like:

function beforeDrawLegendItem( lerh, bounds, icsc )
{
var curr = lerh.getValueLabel().getCaption().getValue();
importPackage( Packages.java.text );
importPackage( Packages.java.lang );
nf = NumberFormat.getPercentInstance(
icsc.getExternalContext().getScriptable().getLocale() );
nf.setMinimumFractionDigits(2);
str = nf.format( Double.parseDouble(curr)/100 );
lerh.getValueLabel().getCaption().setValue(str);

}

Jason

On 2/15/2011 11:34 AM, Mike Wulkan wrote:
> I have a meter chart and I have specified "Show Value" in the legend.
> The values in my case are some percentage that I would like to display
> in the form of nnn.nn%. However I cannot find anyplace in the GUI to
> specify a format for these values and since the value is computed by the
> specified aggregation function, I can't format in my own series script
> and display it as a string.
> Can this be done or do I need to just not use this feature and put in
> some dynamic text under the chart to display the values?
Re: Formatting value in Meter Chart legend [message #654662 is a reply to message #654456] Wed, 16 February 2011 15:38 Go to previous message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 141
Registered: July 2009
Senior Member
Perfect solution (as always) Smile
Previous Topic:Extracting data column binding of a table
Next Topic:Is there a way to set the display format of a date in the dataset data preview?
Goto Forum:
  


Current Time: Tue Dec 23 01:45:46 GMT 2014

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

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