public Object getValue()
{
final Number[] data = getData();
if ("line".equals(type))
{
final LineGraphDrawable drawable = new LineGraphDrawable();
drawable.setBackground(backgroundColor);
drawable.setColor(color);
drawable.setSpacing(spacing);
drawable.setData(data);
return drawable;
}
else if ("bar".equals(type))
{
final BarGraphDrawable drawable = new BarGraphDrawable();
drawable.setBackground(backgroundColor);
drawable.setColor(color);
drawable.setHighColor(highColor);
drawable.setLastColor(lastColor);
drawable.setData(data);
drawable.setSpacing(spacing);
return drawable;
}
else if ("pie".equals(type))
{
final PieGraphDrawable drawable = new PieGraphDrawable();
if (data.length < 1)
{
return null;
}
drawable.setValue(data[0]);
drawable.setColor(color);
drawable.setBackground(backgroundColor);
drawable.setLowColor(lowColor);
drawable.setHighColor(highColor);
drawable.setMediumColor(mediumColor);
drawable.setCounterClockWise(counterClockWise);
drawable.setStartAngle(startAngle);
if (lowSlice != null)
{
drawable.setLowSlice(lowSlice);
}
if (mediumSlice != null)
{
drawable.setMediumSlice(mediumSlice);
}
if (highSlice != null)
{
drawable.setHighSlice(highSlice);
}
return drawable;
}
return null;