* Gets the array of bar rectangles for compressed series.
*
* @return the array of bar rectangles for compressed series
*/
private Rectangle[] getBoundsForCompressedSeries() {
Axis xAxis = (Axis) chart.getAxisSet().getXAxis(xAxisId);
Axis yAxis = (Axis) chart.getAxisSet().getYAxis(yAxisId);
// get x and y series
double[] xseries = compressor.getCompressedXSeries();
double[] yseries = compressor.getCompressedYSeries();
int[] indexes = compressor.getCompressedIndexes();
if (xAxis.isValidCategoryAxis()) {
for (int i = 0; i < xseries.length; i++) {
xseries[i] = indexes[i];
}
}
Rectangle[] rectangles = new Rectangle[xseries.length];
Range xRange = xAxis.getRange();
Range yRange = yAxis.getRange();
for (int i = 0; i < xseries.length; i++) {
int x = xAxis.getPixelCoordinate(xseries[i]);
int y = yAxis
.getPixelCoordinate(isValidStackSeries() ? stackSeries[indexes[i]]
: yseries[i]);
double baseYCoordinate = yAxis.getRange().lower > 0 ? yAxis
.getRange().lower : 0;
double riserwidth = getRiserWidth(xseries, i, xAxis, xRange.lower,
xRange.upper);
double riserHeight = Math.abs(yAxis.getPixelCoordinate(yseries[i],
yRange.lower, yRange.upper)
- yAxis.getPixelCoordinate(
yAxis.isLogScaleEnabled() ? yRange.lower
: baseYCoordinate, yRange.lower,
yRange.upper));
// adjust riser x coordinate and riser width for multiple series
int riserCnt = xAxis.getNumRisers();
if (riserCnt > 1) {
if (xAxis.isHorizontalAxis()) {
x = (int) (x - riserwidth / 2d + riserwidth / riserCnt
* (riserIndex + 0.5));
} else {
x = (int) (x - riserwidth / 2d + riserwidth / riserCnt
* (riserCnt - riserIndex - 0.5));
}
riserwidth /= riserCnt;
}
if (xAxis.isHorizontalAxis()) {
// adjust coordinate for negative series
if (y > yAxis.getPixelCoordinate(0)) {
y = yAxis.getPixelCoordinate(0);
}
int width = (int) Math.ceil(riserwidth);
width = (width == 0) ? 1 : width;
rectangles[i] = getVisibleRectangle((int) Math.floor(x
- riserwidth / 2d), y, width, (int) riserHeight);
} else {
// adjust coordinate for negative series
if (y < yAxis.getPixelCoordinate(0)) {
y = yAxis.getPixelCoordinate(0);
}
int height = (int) Math.ceil(riserwidth);
height = (height == 0) ? 1 : height;