double y0 = bar.getMinY() - getYOffset();
double y1 = bar.getMinY();
double y2 = bar.getMaxY() - getYOffset();
double y3 = bar.getMaxY();
GeneralPath bar3dRight = null;
GeneralPath bar3dTop = null;
if (barLength > 0.0) {
bar3dRight = new GeneralPath();
bar3dRight.moveTo((float) x2, (float) y3);
bar3dRight.lineTo((float) x2, (float) y1);
bar3dRight.lineTo((float) x3, (float) y0);
bar3dRight.lineTo((float) x3, (float) y2);
bar3dRight.closePath();
if (itemPaint instanceof Color) {
g2.setPaint(((Color) itemPaint).darker());
}
else if (itemPaint instanceof GradientPaint)
{
GradientPaint gp = (GradientPaint)itemPaint;
g2.setPaint(
new StandardGradientPaintTransformer().transform(
new GradientPaint(gp.getPoint1(), gp.getColor1().darker(), gp.getPoint2(), gp.getColor2().darker(), gp.isCyclic()),
bar3dRight
)
);
}
g2.fill(bar3dRight);
}
bar3dTop = new GeneralPath();
bar3dTop.moveTo((float) x0, (float) y1);
bar3dTop.lineTo((float) x1, (float) y0);
bar3dTop.lineTo((float) x3, (float) y0);
bar3dTop.lineTo((float) x2, (float) y1);
bar3dTop.closePath();
g2.fill(bar3dTop);
if (isDrawBarOutline()
&& state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD)
{
g2.setStroke(getItemOutlineStroke(row, column));
g2.setPaint(getItemOutlinePaint(row, column));
g2.draw(bar);
if (bar3dRight != null) {
g2.draw(bar3dRight);
}
if (bar3dTop != null) {
g2.draw(bar3dTop);
}
}
CategoryItemLabelGenerator generator
= getItemLabelGenerator(row, column);
if (generator != null && isItemLabelVisible(row, column)) {
drawItemLabel(g2, dataset, row, column, plot, generator, bar, (value < 0.0));
}
// add an item entity, if this information is being collected
EntityCollection entities = state.getEntityCollection();
if (entities != null) {
GeneralPath barOutline = new GeneralPath();
barOutline.moveTo((float) x0, (float) y3);
barOutline.lineTo((float) x0, (float) y1);
barOutline.lineTo((float) x1, (float) y0);
barOutline.lineTo((float) x3, (float) y0);
barOutline.lineTo((float) x3, (float) y2);
barOutline.lineTo((float) x2, (float) y3);
barOutline.closePath();
addItemEntity(entities, dataset, row, column, barOutline);
}
}