Example usage for org.jfree.chart.renderer.xy XYBlockRenderer setBlockHeight

List of usage examples for org.jfree.chart.renderer.xy XYBlockRenderer setBlockHeight

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy XYBlockRenderer setBlockHeight.

Prototype

public void setBlockHeight(double height) 

Source Link

Document

Sets the height of the blocks used to represent each data item and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:com.javafxpert.neuralnetviz.scenario.PlotUtil.java

private static JFreeChart createChart(XYZDataset dataset, double[] mins, double[] maxs, int nPoints,
        XYDataset xyData) {//from   w  ww .  j  a v a2  s.  co  m
    NumberAxis xAxis = new NumberAxis("X");
    xAxis.setRange(mins[0], maxs[0]);

    NumberAxis yAxis = new NumberAxis("Y");
    yAxis.setRange(mins[1], maxs[1]);

    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth((maxs[0] - mins[0]) / (nPoints - 1));
    renderer.setBlockHeight((maxs[1] - mins[1]) / (nPoints - 1));
    PaintScale scale = new GrayPaintScale(0, 1.0);
    renderer.setPaintScale(scale);
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
    JFreeChart chart = new JFreeChart("", plot);
    chart.getXYPlot().getRenderer().setSeriesVisibleInLegend(0, false);

    NumberAxis scaleAxis = new NumberAxis("Probability (class 0)");
    scaleAxis.setAxisLinePaint(Color.white);
    scaleAxis.setTickMarkPaint(Color.white);
    scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 7));
    PaintScaleLegend legend = new PaintScaleLegend(new GrayPaintScale(), scaleAxis);
    legend.setStripOutlineVisible(false);
    legend.setSubdivisionCount(20);
    legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    legend.setAxisOffset(5.0);
    legend.setMargin(new RectangleInsets(5, 5, 5, 5));
    legend.setFrame(new BlockBorder(Color.red));
    legend.setPadding(new RectangleInsets(10, 10, 10, 10));
    legend.setStripWidth(10);
    legend.setPosition(RectangleEdge.LEFT);
    chart.addSubtitle(legend);

    ChartUtilities.applyCurrentTheme(chart);

    plot.setDataset(1, xyData);
    XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer();
    renderer2.setBaseLinesVisible(false);
    plot.setRenderer(1, renderer2);

    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    return chart;
}

From source file:org.gumtree.vis.awt.PlotFactory.java

private static XYBlockRenderer createRender(IXYZDataset dataset, PaintScale scale) {
    //      renderer = new Render2D();
    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setPaintScale(scale);/* ww  w .ja  v a 2s . c  o  m*/
    renderer.setBlockHeight(dataset.getYBlockSize());
    renderer.setBlockWidth(dataset.getXBlockSize());
    return renderer;
}

From source file:org.spf4j.perf.impl.chart.Charts.java

public static JFreeChart createHeatJFreeChart(final String[] dsNames, final double[][] values,
        final long startTimeMillis, final long stepMillis, final String uom, final String chartName) {
    final QuantizedXYZDatasetImpl dataSet = new QuantizedXYZDatasetImpl(dsNames, values, startTimeMillis,
            stepMillis);//from  w w  w . ja  v a 2 s.  co  m
    NumberAxis xAxis = new NumberAxis("Time");
    xAxis.setStandardTickUnits(dataSet.createXTickUnits());
    xAxis.setLowerMargin(0);
    xAxis.setUpperMargin(0);
    xAxis.setVerticalTickLabels(true);
    NumberAxis yAxis = new NumberAxis(uom);
    yAxis.setStandardTickUnits(dataSet.createYTickUnits());
    yAxis.setLowerMargin(0);
    yAxis.setUpperMargin(0);
    XYBlockRenderer renderer = new XYBlockRenderer();
    PaintScale scale;
    if (dataSet.getMinValue() >= dataSet.getMaxValue()) {
        if (dataSet.getMinValue() == Double.POSITIVE_INFINITY) {
            scale = new InverseGrayScale(0, 1);
        } else {
            scale = new InverseGrayScale(dataSet.getMinValue(), dataSet.getMaxValue() + 1);
        }
    } else {
        scale = new InverseGrayScale(dataSet.getMinValue(), dataSet.getMaxValue());
    }
    renderer.setPaintScale(scale);
    renderer.setBlockWidth(1);
    renderer.setBlockHeight(1);
    XYPlot plot = new XYPlot(dataSet, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setRangeMinorGridlinesVisible(false);
    JFreeChart chart = new JFreeChart(chartName, plot);
    PaintScaleLegend legend = new PaintScaleLegend(scale, new NumberAxis("Count"));
    legend.setMargin(0, 5, 0, 5);
    chart.addSubtitle(legend);
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:inflor.core.plots.DensityPlot.java

private XYBlockRenderer updateRenderer(Histogram2D histogram) {
    BitSet nonEmptyMask = histogram.getNonEmptyBins();
    double[] z = FCSUtilities.filterColumn(nonEmptyMask, histogram.getZValues());
    LookupPaintScale paintScale = PlotUtils.createPaintScale(Doubles.max(z), colorScheme);

    // Renderer configuration
    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth(histogram.getXBinWidth());
    renderer.setBlockHeight(histogram.getYBinWidth());
    renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT);
    renderer.setSeriesVisible(0, true);//w ww . j  ava2s .c  o  m
    renderer.setPaintScale(paintScale);
    return renderer;
}

From source file:net.sf.dynamicreports.design.transformation.chartcustomizer.XyBlockRendererCustomizer.java

@Override
public void customize(JFreeChart chart, ReportParameters reportParameters) {
    chart.getXYPlot().getDomainAxis().setUpperMargin(0);
    chart.getXYPlot().getRangeAxis().setUpperMargin(0);

    XYBlockRenderer renderer = new XYBlockRenderer();
    if (xyBlockPlot.getBlockWidth() != null) {
        renderer.setBlockWidth(xyBlockPlot.getBlockWidth());
    }//w  w  w  .  j av  a 2 s . c  o  m
    if (xyBlockPlot.getBlockHeight() != null) {
        renderer.setBlockHeight(xyBlockPlot.getBlockHeight());
    }
    if (xyBlockPlot.getBlockAnchor() != null) {
        renderer.setBlockAnchor(ConstantTransform.rectangleAnchor(xyBlockPlot.getBlockAnchor()));
    }
    LookupPaintScale paintScale = new LookupPaintScale(xyBlockPlot.getDefaultLowerBound(),
            xyBlockPlot.getDefaultUpperBound(), xyBlockPlot.getDefaultPaint());
    for (DRIPaintScale scale : xyBlockPlot.getPaintScales()) {
        paintScale.add(scale.getValue(), scale.getPaint());
    }
    renderer.setPaintScale(paintScale);

    chart.getXYPlot().setRenderer(renderer);

    LegendItemCollection legendItems = new LegendItemCollection();
    for (DRIPaintScale scale : xyBlockPlot.getPaintScales()) {
        legendItems.add(new LegendItem(scale.getLabel(), scale.getPaint()));
    }
    chart.getXYPlot().setFixedLegendItems(legendItems);
}

From source file:inflor.core.plots.CategoryResponseChart.java

public JFreeChart createChart(FCSFrame dataFrame) {

    CategoryXYZDataSet categoryData = new CategoryXYZDataSet();
    double zMin = Double.MAX_VALUE;
    double zMax = 1;
    if (dataFrame.getKeywords().containsKey(FCSUtilities.KEY_MERGE_MAP)) {
        String[] mergeMap = dataFrame.getKeywordValue(FCSUtilities.KEY_MERGE_MAP)
                .split(NodeUtilities.DELIMITER_REGEX);
        FCSDimension dim = dataFrame.getDimension(axisName);
        double[] transformedData = transform.transform(dim.getData());
        int perFileSize = dim.getData().length / mergeMap.length;
        for (int i = 0; i < mergeMap.length; i++) {

            double[] unMergedData = new double[perFileSize];
            for (int j = 0; j < unMergedData.length; j++) {
                unMergedData[j] = transformedData[i * unMergedData.length + j];
            }/*  w ww  .  ja  va  2 s  . c o m*/
            double tMin = transform.getMinTranformedValue();
            double tMax = transform.getMaxTransformedValue();
            Histogram1D hist = new Histogram1D(unMergedData, tMin, tMax, ChartingDefaults.BIN_COUNT);
            double[] x = hist.getNonZeroX();
            double[] y = new double[x.length];
            for (int j = 0; j < y.length; j++) {
                y[j] = i;
            }
            double[] z = hist.getNonZeroY();
            double currentZMin = Doubles.min(z);
            double currentZMax = Doubles.max(z);
            if (currentZMin < zMin) {
                zMin = currentZMin;
            } else if (currentZMax > zMax) {
                zMax = currentZMax;
            }

            categoryData.addCategoricalSeries(mergeMap[i], x, z);
        }
    } else {
        FCSDimension dim = dataFrame.getDimension(axisName);
        double[] transformedData = transform.transform(dim.getData());
        Histogram1D hist = new Histogram1D(transformedData, transform.getMinTranformedValue(),
                transform.getMaxTransformedValue(), ChartingDefaults.BIN_COUNT);
        double[] x = hist.getNonZeroX();
        double[] y = new double[x.length];
        for (int j = 0; j < y.length; j++) {
            y[j] = 0;
        }
        double[] z = hist.getNonZeroY();
        double currentZMin = Doubles.min(z);
        double currentZMax = Doubles.max(z);
        if (currentZMin < zMin) {
            zMin = currentZMin;
        } else if (currentZMax > zMax) {
            zMax = currentZMax;
        }

        categoryData.addCategoricalSeries(dataFrame.getDisplayName(), x, z);
    }

    ValueAxis domainAxis = PlotUtils.createAxis(axisName, transform);
    NumberAxis rangeAxis = new CategoricalNumberAxis("", categoryData.getLabelMap());
    // Renderer configuration
    XYBlockRenderer renderer = new XYBlockRenderer();
    double xWidth = (transform.getMaxTransformedValue() - transform.getMinTranformedValue())
            / ChartingDefaults.BIN_COUNT;
    renderer.setBlockWidth(xWidth);
    renderer.setBlockHeight(0.5);
    renderer.setBlockAnchor(RectangleAnchor.LEFT);

    PaintScale paintScale = PlotUtils.createPaintScale(zMax, ChartingDefaults.DEFAULT_COLOR_SCHEME);
    renderer.setPaintScale(paintScale);

    // Add to panel.
    XYPlot responsePlot = new XYPlot(categoryData, domainAxis, rangeAxis, renderer);
    JFreeChart chart = new JFreeChart(responsePlot);
    chart.removeLegend();
    return chart;
}

From source file:org.spantus.exp.segment.draw.DrawDtw.java

protected JFreeChart createXYZChart() {
    NumberAxis xAxis = new NumberAxis("Sample");
    NumberAxis yAxis = new NumberAxis("target");
    List<List<Double>> data = info.getDistanceMatrix();
    XYZDataset xyzset = new XYZArrayDataset(data);
    XYPlot plot = new XYPlot(xyzset, xAxis, yAxis, null);
    XYBlockRenderer r = new XYBlockRenderer();
    PaintScale ps = new GrayPaintScale(min, max);
    //      LookupPaintScale ps = new LookupPaintScale(0.0, 4.0, Color.WHITE);
    //      ps.add(1, Color.red);
    //      ps.add(2, Color.green);
    //      ps.add(3, Color.gray);

    r.setPaintScale(ps);/*from  w  w  w  . j  a v a  2 s  .  co m*/
    r.setBlockHeight(1.0f);
    r.setBlockWidth(1.0f);
    plot.setRenderer(r);
    JFreeChart chart = new JFreeChart("Chart Title", JFreeChart.DEFAULT_TITLE_FONT, plot, false);
    NumberAxis scaleAxis = new NumberAxis("Scale");
    scaleAxis.setUpperBound(100);
    scaleAxis.setAxisLinePaint(Color.white);
    scaleAxis.setTickMarkPaint(Color.white);
    scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 12));
    //      PaintScaleLegend legend = new PaintScaleLegend(ps, scaleAxis);
    //      legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    //      legend.setPadding(new RectangleInsets(5, 5, 5, 5));
    //      legend.setStripWidth(50);
    //      legend.setPosition(RectangleEdge.RIGHT);
    //      legend.setBackgroundPaint(Color.WHITE);
    //      chart.addSubtitle(legend);
    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.blockcharts.TimeBlockChart.java

@Override
public JFreeChart createChart(DatasetMap datasets) {
    logger.debug("IN");
    super.createChart(datasets);
    DefaultXYZDataset dataset = (DefaultXYZDataset) datasets.getDatasets().get("1");

    DateAxis xAxis = new DateAxis(yLabel);
    xAxis.setLowerMargin(0.0);/*from   w  w w  . ja  va2 s .co  m*/
    xAxis.setUpperMargin(0.0);
    xAxis.setInverted(false);
    xAxis.setDateFormatOverride(new SimpleDateFormat("dd/MM/yyyy"));
    if (dateAutoRange) {
        xAxis.setAutoRange(true);
    } else {
        DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
        DateTickUnit unit = new DateTickUnit(DateTickUnit.DAY, 1, formatter);
        xAxis.setTickUnit(unit);
    }

    if (dateMin != null && dateMax != null) {
        xAxis.setRange(dateMin, addDay(dateMax));
    } else {
        xAxis.setRange(minDateFound, addDay(maxDateFound));
    }

    //      Calendar c=new GregorianCalendar();
    //      c.set(9 + 2000, Calendar.JANUARY, 1);
    //      java.util.Date minima=c.getTime();
    //      Calendar c1=new GregorianCalendar();
    //      c1.set(9 + 2000, Calendar.FEBRUARY, 1);
    //      java.util.Date massima=c1.getTime();

    NumberAxis yAxis = new NumberAxis(xLabel);
    yAxis.setUpperMargin(0.0);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setRange(hourMin, hourMax);

    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth(BLOCK_HEIGHT);
    // one block for each minute!
    renderer.setBlockHeight(0.017);
    //renderer.setBlockWidth(1);
    renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT);

    //      MyXYItemLabelGenerator my=new MyXYItemLabelGenerator();
    //      renderer.setItemLabelsVisible(null);
    //      renderer.setSeriesItemLabelGenerator(0, my);
    //      renderer.setSeriesItemLabelsVisible(0, true);

    //      XYTextAnnotation annotation1 = new XYTextAnnotation(
    //      "P_",1.2309372E12, 14.3);
    //      XYTextAnnotation annotation2 = new XYTextAnnotation(
    //      "P_",1.2308508E12, 16.3);

    for (Iterator iterator = annotations.keySet().iterator(); iterator.hasNext();) {
        String annotationCode = (String) iterator.next();
        AnnotationBlock annotationBlock = annotations.get(annotationCode);
        XYTextAnnotation xyAnnotation = new XYTextAnnotation(annotationBlock.getAnnotation(),
                annotationBlock.getXPosition() + ANNOTATION_HEIGHT, annotationBlock.getYPosition());
        if (styleAnnotation != null) {
            xyAnnotation.setFont(new Font(styleAnnotation.getFontName(), Font.BOLD, styleAnnotation.getSize()));
            xyAnnotation.setPaint(styleAnnotation.getColor());
        } else {
            xyAnnotation.setFont(new Font("Nome", Font.BOLD, 8));
            xyAnnotation.setPaint(Color.BLACK);
        }

        xyAnnotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
        renderer.addAnnotation(xyAnnotation);
    }

    logger.debug("Annotation set");

    LookupPaintScale paintScale = new LookupPaintScale(0.5, ranges.size() + 0.5, color);
    String[] labels = new String[ranges.size() + 1];
    labels[0] = "";

    // ******************** SCALE ****************************
    for (Iterator iterator = ranges.iterator(); iterator.hasNext();) {
        RangeBlocks range = (RangeBlocks) iterator.next();
        Integer index = patternRangeIndex.get(range.getPattern());
        Color color = range.getColor();
        if (color != null) {
            //Paint colorTransparent=new Color(color.getRed(), color.getGreen(), color.getBlue(), 50);         
            Paint colorTransparent = null;
            if (addTransparency == true) {
                colorTransparent = new Color(color.getRed(), color.getGreen(), color.getBlue(), 50);
            } else {
                colorTransparent = new Color(color.getRed(), color.getGreen(), color.getBlue());
            }
            paintScale.add(index + 0.5, colorTransparent);
        }
        //String insertLabel="            "+range.getLabel();
        String insertLabel = range.getLabel();
        labels[index + 1] = insertLabel;
    }
    renderer.setPaintScale(paintScale);

    SymbolAxis scaleAxis = new SymbolAxis(null, labels);
    scaleAxis.setRange(0.5, ranges.size() + 0.5);
    scaleAxis.setPlot(new PiePlot());
    scaleAxis.setGridBandsVisible(false);

    org.jfree.chart.title.PaintScaleLegend psl = new PaintScaleLegend(paintScale, scaleAxis);
    psl.setMargin(new RectangleInsets(3, 10, 3, 10));
    psl.setPosition(RectangleEdge.BOTTOM);
    psl.setAxisOffset(5.0);
    // ******************** END SCALE ****************************

    logger.debug("Scale Painted");

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));

    logger.debug("Plot set");

    JFreeChart chart = new JFreeChart(name, plot);
    if (styleTitle != null) {
        TextTitle title = setStyleTitle(name, styleTitle);
        chart.setTitle(title);
    }
    chart.removeLegend();
    chart.setBackgroundPaint(Color.white);
    chart.addSubtitle(psl);

    logger.debug("OUT");

    return chart;

}

From source file:org.jax.haplotype.analysis.visualization.GenomicGraphFactory.java

/**
 * Create a SNP block graph for the given parameters. This graph
 * will show where the intervals do and don't exist. Interval lists
 * are organized with the X axis label matching the list's key
 * @param snpIntervals/*from   www  .  jav a2s.c  o m*/
 *          the blocks
 * @param startInBasePairs
 *          the x location to start the graph at
 * @param extentInBasePairs
 *          the extent to use for the graph
 * @param maximumImageBlockCount
 *          the max # of separate image blocks to use
 * @param renderAxes
 *          if true render the axes... otherwise dont
 * @param legendText
 *          the text to use for the legend
 * @param yAxisText
 *          the text to use for the y axis
 * @param trueColor
 *          the color to use for true
 * @param falseColor
 *          the color to use for false 
 * @return
 *          the graph
 */
public JFreeChart createSnpIntervalGraph(
        final Map<String, ? extends List<? extends BasePairInterval>> snpIntervals, final long startInBasePairs,
        final long extentInBasePairs, final int maximumImageBlockCount, final boolean renderAxes,
        final String legendText, final String yAxisText, final Color trueColor, final Color falseColor) {
    XYDataset dataset = snpIntervalsToDataset(snpIntervals, startInBasePairs, extentInBasePairs,
            maximumImageBlockCount);

    NumberAxis xAxis = new NumberAxis("SNP Position (Base Pairs)");
    xAxis.setAutoRangeIncludesZero(false);
    xAxis.setRange(new Range(startInBasePairs, startInBasePairs + extentInBasePairs));
    String[] sortedStrainNames = extractSortedStrainNames(snpIntervals);
    for (int strainIndex = 0; strainIndex < sortedStrainNames.length; strainIndex++) {
        LOG.info("Strain Name: " + sortedStrainNames[strainIndex]);
    }
    SymbolAxis yAxis = new SymbolAxis(yAxisText == null ? "" : yAxisText, sortedStrainNames);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    LegendItemCollection items = new LegendItemCollection();
    if (legendText != null) {
        items.add(new LegendItem(legendText, null, null, null, new Rectangle2D.Double(-3.0, -3.0, 6.0, 6.0),
                trueColor, new BasicStroke(), Color.BLACK));
    }
    plot.setFixedLegendItems(items);

    XYBlockRenderer r = new XYBlockRenderer();
    SmoothPaintScale ps = new SmoothPaintScale(0.0, 1.0, falseColor, trueColor);

    r.setPaintScale(ps);
    r.setBlockHeight(1.0);
    r.setBlockWidth(1.0);
    plot.setRenderer(r);

    final JFreeChart chart;
    if (renderAxes) {
        chart = new JFreeChart("Identical By State Blocks", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    } else {
        xAxis.setVisible(false);
        yAxis.setVisible(false);
        plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
        chart = new JFreeChart(plot);
    }

    chart.setBackgroundPaint(Color.WHITE);

    return chart;
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.XYCharts.BlockChart.java

/**
 * Creates a chart for the specified dataset.
 * //from   w  w  w. j a v a2s.c o m
 * @param dataset  the dataset.
 * 
 * @return A chart instance.
 */
public JFreeChart createChart(DatasetMap datasets) {
    XYZDataset dataset = (XYZDataset) datasets.getDatasets().get("1");
    //Creates the xAxis with its label and style
    NumberAxis xAxis = new NumberAxis(xLabel);
    xAxis.setLowerMargin(0.0);
    xAxis.setUpperMargin(0.0);
    xAxis.setLabel(xLabel);
    if (addLabelsStyle != null && addLabelsStyle.getFont() != null) {
        xAxis.setLabelFont(addLabelsStyle.getFont());
        xAxis.setLabelPaint(addLabelsStyle.getColor());
    }
    //Creates the yAxis with its label and style
    NumberAxis yAxis = new NumberAxis(yLabel);

    yAxis.setAutoRangeIncludesZero(false);
    yAxis.setInverted(false);
    yAxis.setLowerMargin(0.0);
    yAxis.setUpperMargin(0.0);
    yAxis.setTickLabelsVisible(true);
    yAxis.setLabel(yLabel);
    if (addLabelsStyle != null && addLabelsStyle.getFont() != null) {
        yAxis.setLabelFont(addLabelsStyle.getFont());
        yAxis.setLabelPaint(addLabelsStyle.getColor());
    }
    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());
        scaleAxis2.setGridBandsVisible(false);

        //draws legend as chart subtitle
        PaintScaleLegend psl2 = new PaintScaleLegend(legendPaintScale2, scaleAxis2);
        psl2.setAxisOffset(5.0);
        psl2.setPosition(RectangleEdge.LEFT);
        psl2.setMargin(new RectangleInsets(8, 1, 40, 1));
        psl2.setStripWidth(0);
        psl2.setStripOutlineVisible(false);
        chart.addSubtitle(psl2);
    }

    return chart;
}