Controlling the color of each Pie Slice [message #1852403] |
Sat, 14 May 2022 00:21 |
Angie Honeycutt 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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.09725 seconds