Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » 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 17:10 Go to next message
nari noori is currently offline nari nooriFriend
Messages: 33
Registered: November 2012
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 368 times)

[Updated on: Fri, 17 May 2013 17: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 04:13 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
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.


Michael

Developer Evangelist, Silanis
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 22:01 Go to previous messageGo to next message
nari noori is currently offline nari nooriFriend
Messages: 33
Registered: November 2012
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 19:08 Go to previous messageGo to next message
David Gress is currently offline David GressFriend
Messages: 2
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 04:34 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

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

Michael

Developer Evangelist, Silanis
Previous Topic:How to calculate elapsed time?
Next Topic:Date parameter not Working
Goto Forum:
  


Current Time: Sat Apr 27 03:28:11 GMT 2024

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

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

Back to the top