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"){
fill.set(0,140,153);
}
//else if (fcdph.getDataPointHints().getBaseDisplayValue() == "Total Equity"){
//fill.set(112,204,211);
//}
//else if (fcdph.getDataPointHints().getBaseDisplayValue() == "Total Benefits"){
//fill.set(255,78,0);
//}
else{
fill.set(255,78,0);
}
}

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
else
{
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: 33142
Registered: July 2009
Senior Member
It's better to ask here:

https://github.com/eclipse/birt/discussions


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:jax-ws-3.0.0 maven build failure
Next Topic: Issue with tycho-surefire-plugin
Goto Forum:
  


Current Time: Fri Apr 26 20:33:21 GMT 2024

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

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

Back to the top