Skip to main content



      Home
Home » Archived » BIRT » BIRT Chart color manipulation
BIRT Chart color manipulation [message #1008287] Mon, 11 February 2013 14:03 Go to next message
Eclipse UserFriend
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 14:10] by Moderator

Re: BIRT Chart color manipulation [message #1008310 is a reply to message #1008287] Mon, 11 February 2013 16:15 Go to previous messageGo to next message
Eclipse UserFriend
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 17:51 Go to previous messageGo to next message
Eclipse UserFriend
That is what it is used for.

Jason
Re: BIRT Chart color manipulation [message #1008337 is a reply to message #1008327] Mon, 11 February 2013 19:16 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Jason
Re: BIRT Chart color manipulation [message #1804148 is a reply to message #1008337] Tue, 19 March 2019 07:00 Go to previous message
Eclipse UserFriend
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 Jul 15 01:07:55 EDT 2025

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

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

Back to the top