Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » custom format x-axis and y-axis label in chart by script
custom format x-axis and y-axis label in chart by script [message #1059370] Fri, 17 May 2013 13:10 Go to next message
nari noori is currently offline nari noori
Messages: 24
Registered: November 2012
Junior Member
I want to format x-axis labels and y-axis labels through script, with my custom java method. Cant figure out where to set the label-value in script.

I see that on script-tab onRender one can code event functions. which one to use ?

I know how to do this in a tables data-item:
this.setDisplayValue(Packages.Utilities.formatToStandardNumber(this.getValue()));

thanks
  • Attachment: format.png
    (Size: 12.22KB, Downloaded 10 times)

[Updated on: Fri, 17 May 2013 13:11]

Report message to a moderator

Re: custom format x-axis and y-axis label in chart by script [message #1059407 is a reply to message #1059370] Sat, 18 May 2013 00:13 Go to previous messageGo to next message
Michael Williams is currently offline Michael Williams
Messages: 828
Registered: July 2009
Senior Member

In a chart, it'd be in the beforeDrawAxisLabel() function in the onRender of the chart. You can set the value of the label with:

label.getCaption().setValue("newValue");

Hope this helps.


Regards,

Michael Williams
BIRT Exchange
Michael's BIRT Blog
Re: custom format x-axis and y-axis label in chart by script [message #1059457 is a reply to message #1059407] Sat, 18 May 2013 18:01 Go to previous messageGo to next message
nari noori is currently offline nari noori
Messages: 24
Registered: November 2012
Junior Member
thanks Williams, it works, but is it possible to get the label value as an integer? i get the label value as pre-formatted as String...100000 is for exampled returned as 100 000 .
Re: custom format x-axis and y-axis label in chart by script [message #1059605 is a reply to message #1059407] Mon, 20 May 2013 15:08 Go to previous messageGo to next message
David Gress is currently offline David Gress
Messages: 1
Registered: May 2013
Junior Member
When I try this code my chart disappears.
I tried

function beforeDrawAxisTitle( axis, label, icsc )
{
importPackage(Packages.org.eclipse.birt.chart.model.attribute);

if (axis.getType() == AxisType.LINEAR_LITERAL){ //Y-axis
axis.setTitle("custom title");
}

}
Is there something that I need to do beyond this?

I tried using the beforeGeneration event but get the same results.

I'm using Actuate 11SP3.
Re: custom format x-axis and y-axis label in chart by script [message #1059637 is a reply to message #1059457] Tue, 21 May 2013 00:34 Go to previous message
Michael Williams is currently offline Michael Williams
Messages: 828
Registered: July 2009
Senior Member

I don't believe so. You'll probably have to parse it into an integer on your own.

Regards,

Michael Williams
BIRT Exchange
Michael's BIRT Blog
Previous Topic:org.eclipse.birt.report.service.api.ReportServiceException
Next Topic:Date parameter not Working
Goto Forum:
  


Current Time: Tue May 28 22:32:13 EDT 2013

Powered by FUDForum. Page generated in 0.01680 seconds