Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » BIRT Chart color manipulation
BIRT Chart color manipulation [message #1008287] Mon, 11 February 2013 19:03 Go to next message
A R is currently offline A RFriend
Messages: 104
Registered: April 2012
Senior Member
My graph is binded to one dataset and I am using the following script in the on render, after data set filled to fix the axis details :
====================================================================================

importPackage( Packages.java.util );
importPackage( Packages.org.eclipse.birt.chart.model.type.impl );

importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);


function afterDataSetFilled(series, dataSet, icsc)
{

if( series.getClass() == BarSeriesImpl ){
var list = dataSet.getValues();

var X= parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("X"));
var Y= parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Y"));
var Z= parseInt(icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Z"));

var narray1 = new ArrayList( );

narray1.add(X);
narray1.add(Y);
narray1.add(Z);

dataSet.setValues(narray1);
}else{
var catArray = new ArrayList();

catArray.add("Naming Convention ");
catArray.add("Basic Profile ");
catArray.add("Non-Stanbdard ");

dataSet.setValues(catArray);
}


}
====================================================================================

If I want to use the different colors to each bar in the graph how can I improve the script.

Thanks
AR

[Updated on: Mon, 11 February 2013 19:10]

Report message to a moderator

Re: BIRT Chart color manipulation [message #1008310 is a reply to message #1008287] Mon, 11 February 2013 21:15 Go to previous messageGo to next message
A R is currently offline A RFriend
Messages: 104
Registered: April 2012
Senior Member
I managed this without script by using "Edit Chart>Format chart> Series >Color By :Categories (I selected 'Categories' instead of 'Value Series').

Please let me know if I my approch is wrong.
Re: BIRT Chart color manipulation [message #1008327 is a reply to message #1008310] Mon, 11 February 2013 22:51 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

That is what it is used for.

Jason
Re: BIRT Chart color manipulation [message #1008337 is a reply to message #1008327] Tue, 12 February 2013 00:16 Go to previous messageGo to next message
A R is currently offline A RFriend
Messages: 104
Registered: April 2012
Senior Member
Thanks Jason
Re: BIRT Chart color manipulation [message #1804148 is a reply to message #1008337] Tue, 19 March 2019 11:00 Go to previous message
hatra atrin is currently offline hatra atrinFriend
Messages: 20
Registered: February 2014
Junior Member
How would you go about it if you have 3 Y series for each X series ie, the X series are cities, Each city would have 3 bar side by side and want to have them as series 1 green, series 2 yellow and series 3 Red?
cheers
Previous Topic:JBoss, birt.war - deploy own report - how?
Next Topic:Cannot get result set metadata
Goto Forum:
  


Current Time: Tue Mar 19 07:02:39 GMT 2024

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

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

Back to the top