final float transY1;
final RectangleEdge edge1 = plot.getRangeAxisEdge();
final GeneralPath left = new GeneralPath();
final GeneralPath right = new GeneralPath();
if (y1 >= 0.0) { // handle positive value
transY1 = (float) rangeAxis.valueToJava2D(y1 + stack1[1], dataArea,
edge1);
final float transStack1 = (float) rangeAxis.valueToJava2D(stack1[1],
dataArea, edge1);
final float transStackLeft = (float) rangeAxis.valueToJava2D(
adjStackLeft[1], dataArea, edge1);
// LEFT POLYGON
if (y0 >= 0.0) {
final double yleft = (y0 + y1) / 2.0 + stackLeft[1];
final float transYLeft
= (float) rangeAxis.valueToJava2D(yleft, dataArea, edge1);
left.moveTo((float) xx1, transY1);
left.lineTo((float) xx1, transStack1);
left.lineTo((float) xxLeft, transStackLeft);
left.lineTo((float) xxLeft, transYLeft);
left.closePath();
}
else {
left.moveTo((float) xx1, transStack1);
left.lineTo((float) xx1, transY1);
left.lineTo((float) xxLeft, transStackLeft);
left.closePath();
}
final float transStackRight = (float) rangeAxis.valueToJava2D(
adjStackRight[1], dataArea, edge1);
// RIGHT POLYGON
if (y2 >= 0.0) {
final double yright = (y1 + y2) / 2.0 + stackRight[1];
final float transYRight
= (float) rangeAxis.valueToJava2D(yright, dataArea, edge1);
right.moveTo((float) xx1, transStack1);
right.lineTo((float) xx1, transY1);
right.lineTo((float) xxRight, transYRight);
right.lineTo((float) xxRight, transStackRight);
right.closePath();
}
else {
right.moveTo((float) xx1, transStack1);
right.lineTo((float) xx1, transY1);
right.lineTo((float) xxRight, transStackRight);
right.closePath();
}
}
else { // handle negative value
transY1 = (float) rangeAxis.valueToJava2D(y1 + stack1[0], dataArea,
edge1);
final float transStack1 = (float) rangeAxis.valueToJava2D(stack1[0],
dataArea, edge1);
final float transStackLeft = (float) rangeAxis.valueToJava2D(
adjStackLeft[0], dataArea, edge1);
// LEFT POLYGON
if (y0 >= 0.0) {
left.moveTo((float) xx1, transStack1);
left.lineTo((float) xx1, transY1);
left.lineTo((float) xxLeft, transStackLeft);
left.clone();
}
else {
final double yleft = (y0 + y1) / 2.0 + stackLeft[0];
final float transYLeft = (float) rangeAxis.valueToJava2D(yleft,
dataArea, edge1);
left.moveTo((float) xx1, transY1);
left.lineTo((float) xx1, transStack1);
left.lineTo((float) xxLeft, transStackLeft);
left.lineTo((float) xxLeft, transYLeft);
left.closePath();
}
final float transStackRight = (float) rangeAxis.valueToJava2D(
adjStackRight[0], dataArea, edge1);
// RIGHT POLYGON
if (y2 >= 0.0) {
right.moveTo((float) xx1, transStack1);
right.lineTo((float) xx1, transY1);
right.lineTo((float) xxRight, transStackRight);
right.closePath();
}
else {
final double yright = (y1 + y2) / 2.0 + stackRight[0];
final float transYRight = (float) rangeAxis.valueToJava2D(yright,
dataArea, edge1);
right.moveTo((float) xx1, transStack1);
right.lineTo((float) xx1, transY1);
right.lineTo((float) xxRight, transYRight);
right.lineTo((float) xxRight, transStackRight);
right.closePath();
}
}
if (pass == 0) {
final Paint itemPaint = getItemPaint(row, column);
g2.setPaint(itemPaint);
g2.fill(left);
g2.fill(right);
// add an entity for the item...
if (entities != null) {
final GeneralPath gp = new GeneralPath(left);
gp.append(right, false);
entityArea = gp;
addItemEntity(entities, dataset, row, column, entityArea);
}
}
else if (pass == 1) {