final DefaultPieDataset result = new DefaultPieDataset();
if(whole.isEmpty()){
double total = 0;
for(String attribDispText : others.keySet()){
ObjectAttribute otherAttrib = others.get(attribDispText);
double segment = ((Long)otherAttrib.getValue()).doubleValue();
total += segment;
}
for(String attribDispText : others.keySet()){
ObjectAttribute otherAttrib = others.get(attribDispText);
attribDispText += " in %";
double segment = ((Long)otherAttrib.getValue()).doubleValue();
segment = (100 * segment)/total;
result.setValue(attribDispText, new Double(segment));
}
}else{
String displayText = whole.keySet().iterator().next();
ObjectAttribute attrib = whole.get(displayText);
double wholeValue = ((Long)attrib.getValue()).doubleValue();
double sumOthers = 0;
for(String attribDispText : others.keySet()){
ObjectAttribute otherAttrib = others.get(attribDispText);
attribDispText += " in %";
double segment = ((Long)otherAttrib.getValue()).doubleValue();
segment = (100 * segment)/wholeValue;
result.setValue(attribDispText, new Double(segment));
sumOthers += segment;
}
displayText += " in %";