Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Controlling the color of each Pie Slice
Controlling the color of each Pie Slice [message #1852403] Sat, 14 May 2022 00:21 Go to next message
Angie Honeycutt is currently offline Angie HoneycuttFriend
Messages: 1
Registered: May 2019
Junior Member
I have read several older posts on the code to control the color of each pie slice and I have tried the code of each one I found and nothing is working for me.

I do not know Java so please be nice.

I have tried using this code that I found on this forum.

function beforeDrawDataPoint( fcdph, fill, fcsc )
if (fcdph.getBaseDisplayValue() == "Total Cash"){
//else if (fcdph.getDataPointHints().getBaseDisplayValue() == "Total Equity"){
//else if (fcdph.getDataPointHints().getBaseDisplayValue() == "Total Benefits"){

What should be the field listed in quotes? Nothing I have tried works.

I have my series field which is an Amount field, my Category which is a text field.

I want to control the slice colors by the different category names. I only have 3 as seen above. Is this the correct code to accomplish this? If so, what am I missing.

I have also tried using this code;

function beforeDrawDataPoint( dph, fill, icsc )
var stateKey = dph.getBaseDisplayValue();
if(stateKey.contains('Total Cash'))
fill.set(0, 140, 153);
} // Set to RED
else if(stateKey.contains('Total Equity'))
fill.set(112, 204, 0);
} // Set to Green
else if(stateKey.contains('Total Benefits'))
fill.set(255, 78, 0);
} // Set to Black
fill.set(0, 0, 64);
}// Set to Blue

I have loaded this code into the OnRender Script of the chart. Should it be someplace else?

Any help you can provide would be very appreciated.

I am using the most recent version of Eclipse.

I am simply want to control the colors of the slices and not have BIRT randomly pick a color from the palette.

Thanks in advance.

Re: Controlling the color of each Pie Slice [message #1852464 is a reply to message #1852403] Tue, 17 May 2022 09:32 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 32653
Registered: July 2009
Senior Member
It's better to ask here:

Ed Merks
Professional Support:
Previous Topic:jax-ws-3.0.0 maven build failure
Next Topic: Issue with tycho-surefire-plugin
Goto Forum:

Current Time: Fri Jan 27 12:39:46 GMT 2023

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

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

Back to the top