yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
Color outboundCol = new Color(Integer.decode(outboundColor).intValue());
//Sets the graph paint scale and the legend paintscale
LookupPaintScale paintScale = new LookupPaintScale(zvalues[0], (new Double(zrangeMax)).doubleValue(),outboundCol);
LookupPaintScale legendPaintScale = new LookupPaintScale(0.5, 0.5+zvalues.length, outboundCol);
for (int ke=0; ke<=(zvalues.length-1) ; ke++){
Double key =(new Double(zvalues[ke]));
Color temp =(Color)colorRangeMap.get(key);
paintScale.add(zvalues[ke],temp);
legendPaintScale.add(0.5+ke, temp);
}
//Configures the renderer
XYBlockRenderer renderer = new XYBlockRenderer();
renderer.setPaintScale(paintScale);
double blockHeight = (new Double(blockH)).doubleValue();
double blockWidth = (new Double(blockW)).doubleValue();
renderer.setBlockWidth(blockWidth);
renderer.setBlockHeight(blockHeight);
//configures the plot with title, subtitle, axis ecc.
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.black);
plot.setRangeGridlinePaint(Color.black);
plot.setDomainCrosshairPaint(Color.black);
plot.setForegroundAlpha(0.66f);
plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
JFreeChart chart = new JFreeChart(plot);
TextTitle title =setStyleTitle(name, styleTitle);
chart.setTitle(title);
if(subName!= null && !subName.equals("")){
TextTitle subTitle =setStyleTitle(subName, styleSubTitle);
chart.addSubtitle(subTitle);
}
chart.removeLegend();
chart.setBackgroundPaint(Color.white);
//Sets legend labels
SymbolAxis scaleAxis = new SymbolAxis(null,legendLabels);
scaleAxis.setRange(0.5, 0.5+zvalues.length);
scaleAxis.setPlot(new PiePlot());
scaleAxis.setGridBandsVisible(false);
scaleAxis.setLabel(zLabel);
//scaleAxis.setLabelAngle(3.14/2);
scaleAxis.setLabelFont(addLabelsStyle.getFont());
scaleAxis.setLabelPaint(addLabelsStyle.getColor());
//draws legend as chart subtitle
PaintScaleLegend psl = new PaintScaleLegend(legendPaintScale, scaleAxis);
psl.setAxisOffset(2.0);
psl.setPosition(RectangleEdge.RIGHT);
psl.setMargin(new RectangleInsets(5, 1, 5, 1));
chart.addSubtitle(psl);
if(yLabels!=null){
//Sets y legend labels
LookupPaintScale legendPaintScale2 = new LookupPaintScale(0, (yLabels.length-1), Color.white);
for (int ke=0; ke<yLabels.length ; ke++){
Color temp =Color.white;
legendPaintScale2.add(1+ke, temp);
}
SymbolAxis scaleAxis2 = new SymbolAxis(null,yLabels);
scaleAxis2.setRange(0, (yLabels.length-1));
scaleAxis2.setPlot(new PiePlot());