protected void createElements() {
elements.add( getPieChartFromColumn( 0 ) );
}
public Element getPieChartFromColumn( int col ) {
PieChart pc = new PieChart();
PieChart.Slice[] slices = new PieChart.Slice[getRowCount()];
for ( int row = 0; row < getRowCount(); row++ ) {
double d = ( (Number) getValueAt( row, col ) ).doubleValue();
// Labels are already set - use them
String label = (String) chart.getXAxis().getLabels().getLabels().get( row );
slices[row] = new PieChart.Slice( d, label, label );
if ( tooltipText != null ) {
slices[row].setTooltip( tooltipText );
}
}
pc.addSlices( slices );
pc.setColours( colors );
pc.setStartAngle( startAngle );
pc.setAnimate( animate );
if ( alpha != null ) {
pc.setAlpha( alpha );
}
return pc;
}