}
acumY += yValue[j];
y = bbox.getY() + bbox.getHeight() - (acumY - min.getY()) * yScale;
if (areasCommands.get(j) == null) {
commands = new ArrayList<PathCommand>();
commands.add(new MoveTo(x, y));
areasCommands.put(j, commands);
} else {
commands = areasCommands.get(j);
commands.add(new LineTo(x, y));
}
componentCommands.add(new LineTo(x, y));
pointsUp.get(j).add(new PrecisePoint(x, y));
}
}
int prevAreaIndex = 0;
// Close the paths
for (int i = 0; i < yFields.size(); i++) {
if (exclude.contains(i)) {
continue;
}
pointsDown.put(i, new ArrayList<PrecisePoint>());
commands = areasCommands.get(i);
// Close bottom path to the axis
if (first) {
first = false;
commands.add(new LineTo(x, bbox.getY() + bbox.getHeight()));
commands.add(new LineTo(bbox.getX(), bbox.getY() + bbox.getHeight()));
}
// Close other paths to the one before them
else {
componentCommands = areasComponentCommands.get(prevAreaIndex);
// reverse the componentCommands
for (int j = 0; j < componentCommands.size() / 2; j++) {
command = componentCommands.remove(j);
componentCommands.add(componentCommands.size() - j, command);
command = componentCommands.remove(componentCommands.size() - j - 2);
componentCommands.add(j, command);
}
command = componentCommands.get(0);
if (command instanceof MoveTo) {
commands.add(new LineTo(x, ((MoveTo) command).getY()));
} else if (command instanceof LineTo) {
commands.add(new LineTo(x, ((LineTo) command).getY()));
}
for (int j = 0; j < ln; j++) {
command = componentCommands.get(j);
if (command instanceof MoveTo) {
commands.add(new MoveTo((MoveTo) command));
} else if (command instanceof LineTo) {
commands.add(new LineTo((LineTo) command));
}
EndPointCommand point = (EndPointCommand) command;
pointsDown.get(i).add(0, new PrecisePoint(point.getX(), point.getY()));