Say I have multiple detail bands containing pie charts. Each pie chart's JRXML looks like:
<pieDataset>
<keyExpression><![CDATA[$F{PieSlice}.label]]></keyExpression>
<valueExpression><![CDATA[$F{PieSlice}.value]]></valueExpression>
</pieDataset>
And then I use a JRBeanArrayDataSource
to fill those pie charts:
public class PieSlice
{
private String label;
private Double value;
public PieSlice()
{
this("", -1);
}
public PieSlice(String lbl, Double val)
{
setLabel(lbl);
setValue(val);
}
public String getLabel()
{
return label;
}
public String getValue()
{
return value;
}
}
public class PieSliceFactory
{
private static PieSlice[] slices =
{
new PieSlice("Fizz", 75.0),
new PieSlice("Buzz", 25.0);
};
public static PieSlice[] getSlices()
{
return ArrayList.asList(slices);
}
}
JasperReport jasperReport = JasperFillManager.fillReport(jasperDesign, new JRBeanArrayDataSource(PieSliceFactory.getSlices()));
Then how do I specify which data from the bean array gets "routed" to the correct pie chart? What if I only want the "Fizz" pie slice to go to pie chart X inside detail band A, but I want the "Buzz" slice to fill pie chart Y inside detail band B?
Is there a way to use IDs in the expressions or CDATA
? There has to be a way to make specify which bands/elements data gets mapped to. The expression $F{ClassName}.property
just seems too generic. Thanks in advance!