Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Via scripting - change Pie chart legend position from left to right(Via scripting - change Pie chart legend position from left to right)
Via scripting - change Pie chart legend position from left to right [message #1284391] Fri, 04 April 2014 12:16 Go to next message
Anthony Farrell is currently offline Anthony FarrellFriend
Messages: 17
Registered: December 2013
Junior Member
We have a requirement to render charts based on there locale, e.g. if the chart is displayed for an Arabic user, the chart should be rendered "right to left".

What does this mean for a pie chart, if the legend is normally displayed on the right hand side, then for an Arabic user the legend should now be positioned on the left hand side.


I have added script to change the legend frame colour, the border colour, to set the legend to visible/invisible, see below, they all work fine.

But the line of script to move the legends position from right to left does not work?

I guess is something simple like calling a re-paint method or something, if this is not possible in Java script is it possible by writing a Java Event handler/Adaptor?

Regards.
Anthony.

Here is the output of the debug lines (before the chart position is right, after
we update the setting to left, but the legend is still on the right!!!)
current setting=Right
current setting=3
updated setting=Left
updated setting=2


function beforeDrawBlock( block, icsc )
{
importPackage( Packages.org.eclipse.birt.report.model.api );
importPackage( Packages.org.eclipse.birt.chart.model.impl );
importPackage( Packages.org.eclipse.birt.report.model.api );
importPackage( Packages.com.coresecuirty.report );
importPackage( Packages.org.eclipse.birt.chart.model.impl );
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );
importPackage( Packages.org.eclipse.birt.chart.model.attribute );
importPackage( Packages.org.eclipse.birt.chart.model.component.impl );
importPackage( Packages.org.eclipse.birt.chart.model.component );
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );
importPackage(Packages.java.lang);
importPackage( Packages.java.io );
importPackage(Packages.java.util.logging);

logger = Logger.getLogger("mybirttest");
myhandlers = logger.getHandlers();
out = new PrintWriter( new FileWriter( "c:/birt.txt", false ) );


if( myhandlers.length == 0 ){
logger.setLevel(Level.INFO);
fileHandler = new FileHandler("c:/birt.log", 100000, 1, false);
fileHandler.setFormatter(new XMLFormatter());
//var rootLogger = Logger.getLogger("");
//rootLogger.addHandler(fileHandler);
logger.addHandler(fileHandler);
}


if ( block.isLegend( ) )
{

block.getOutline( ).setVisible( true );
block.getOutline( ).getColor( ).set( 21,244,231 );

block.setBackground( ColorDefinitionImpl.YELLOW( ) );
out.println( "block.setPosition=" + block.getPosition());
out.println( "block.setPosition=" + block.getPosition().getValue());
block.setVisible(false);

block.setAnchor( Anchor.SOUTH_LITERAL );
block.setPosition(Position.RIGHT_LITERAL);
block.setVisible(true);
out.println( "block.setPosition=" + block.getPosition());
out.println( "block.setPosition=" + block.getPosition().getValue());

out.flush();
}
else if ( block.isPlot( ) )
{
}
else if ( block.isTitle( ) )
{
}
else if ( block.isCustom( ) ) //Main Block
{
}
out.close();
}
Re: Via scripting - change Pie chart legend position from left to right [message #1288794 is a reply to message #1284391] Tue, 08 April 2014 21:45 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Have you tried grabbing the chart in the beforeFactory and changing the position there? Let me know. Also let me know your BIRT version and I'll try it out.

Michael

Developer Evangelist, Silanis
Previous Topic: Convert a String like 123:34:23 to actual Time format in birt report designer
Next Topic:BIRT report with chinese titles in chart
Goto Forum:
  


Current Time: Fri Apr 19 21:13:46 GMT 2024

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

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

Back to the top