Example usage for org.jfree.chart.title PaintScaleLegend setAxisLocation

List of usage examples for org.jfree.chart.title PaintScaleLegend setAxisLocation

Introduction

In this page you can find the example usage for org.jfree.chart.title PaintScaleLegend setAxisLocation.

Prototype

public void setAxisLocation(AxisLocation location) 

Source Link

Document

Sets the axis location and sends a TitleChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.XYBlockChartDemo1.java

private static JFreeChart createChart(XYZDataset xyzdataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setLowerMargin(0.0D);/*  ww w  .  j ava  2 s.  c  o m*/
    numberaxis.setUpperMargin(0.0D);
    numberaxis.setAxisLinePaint(Color.white);
    numberaxis.setTickMarkPaint(Color.white);
    NumberAxis numberaxis1 = new NumberAxis("Y");
    numberaxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis1.setLowerMargin(0.0D);
    numberaxis1.setUpperMargin(0.0D);
    numberaxis1.setAxisLinePaint(Color.white);
    numberaxis1.setTickMarkPaint(Color.white);
    XYBlockRenderer xyblockrenderer = new XYBlockRenderer();
    GrayPaintScale graypaintscale = new GrayPaintScale(-2D, 1.0D);
    xyblockrenderer.setPaintScale(graypaintscale);
    XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyblockrenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinesVisible(false);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setOutlinePaint(Color.blue);
    JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo1", xyplot);
    jfreechart.removeLegend();
    NumberAxis numberaxis2 = new NumberAxis("Scale");
    numberaxis2.setAxisLinePaint(Color.white);
    numberaxis2.setTickMarkPaint(Color.white);
    numberaxis2.setTickLabelFont(new Font("Dialog", 0, 7));
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(new GrayPaintScale(), numberaxis2);
    paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    paintscalelegend.setAxisOffset(5D);
    paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D));
    paintscalelegend.setFrame(new BlockBorder(Color.red));
    paintscalelegend.setPadding(new RectangleInsets(10D, 10D, 10D, 10D));
    paintscalelegend.setStripWidth(10D);
    paintscalelegend.setPosition(RectangleEdge.RIGHT);
    paintscalelegend.setBackgroundPaint(new Color(120, 120, 180));
    jfreechart.addSubtitle(paintscalelegend);
    jfreechart.setBackgroundPaint(new Color(180, 180, 250));
    return jfreechart;
}

From source file:org.jfree.chart.demo.XYShapeRendererDemo1.java

private static JFreeChart createChart(XYZDataset xyzdataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    numberaxis.setAutoRangeIncludesZero(false);
    NumberAxis numberaxis1 = new NumberAxis("Y");
    numberaxis1.setAutoRangeIncludesZero(false);
    XYShapeRenderer xyshaperenderer = new XYShapeRenderer();
    LookupPaintScale lookuppaintscale = new LookupPaintScale(1.0D, 4D, new Color(0, 0, 255));
    lookuppaintscale.add(2D, new Color(100, 100, 255));
    lookuppaintscale.add(3D, new Color(200, 200, 255));
    xyshaperenderer.setPaintScale(lookuppaintscale);
    XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyshaperenderer);
    xyplot.setDomainPannable(true);//from  www. java 2 s  .  c o  m
    xyplot.setRangePannable(true);
    JFreeChart jfreechart = new JFreeChart("XYShapeRendererDemo1", xyplot);
    jfreechart.removeLegend();
    NumberAxis numberaxis2 = new NumberAxis("Score");
    numberaxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, numberaxis2);
    paintscalelegend.setPosition(RectangleEdge.RIGHT);
    paintscalelegend.setMargin(4D, 4D, 40D, 4D);
    paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    jfreechart.addSubtitle(paintscalelegend);
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
}

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 w  w . java2 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 PaintScaleLegend createScaleLegend(PaintScale scale, NumberAxis scaleAxis) {

    PaintScaleLegend legend = new PaintScaleLegend2D(scale, scaleAxis);
    legend.setSubdivisionCount(20);/* ww w.  j  a v a  2 s  . c o  m*/
    legend.setStripOutlineVisible(false);
    legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    legend.setAxisOffset(5);
    RectangleInsets rec = new RectangleInsets(5, 0, 10, 5);
    legend.setMargin(rec);
    RectangleInsets rec2 = new RectangleInsets(4, 0, 22, 2);
    legend.setPadding(rec2);
    legend.setStripWidth(10);
    legend.setPosition(RectangleEdge.RIGHT);
    return legend;
}

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

/**
 * Creates a chart for the specified dataset.
 * /* w  ww .  j a  v  a2  s .com*/
 * @param dataset  the dataset.
 * 
 * @return A chart instance.
 */
public JFreeChart createChart(DatasetMap datasets) {
    logger.debug("IN");
    XYZDataset dataset = (XYZDataset) datasets.getDatasets().get("1");

    JFreeChart chart = null;

    NumberAxis xAxis = new NumberAxis(xLabel);
    xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    if (xLowerBound != null && xUpperBound != null) {
        xAxis.setLowerBound(xLowerBound);
        xAxis.setUpperBound(xUpperBound);
    } else {
        xAxis.setAutoRange(true);
    }
    xAxis.setAxisLinePaint(Color.white);
    xAxis.setTickMarkPaint(Color.white);

    if (addLabelsStyle != null && addLabelsStyle.getFont() != null) {
        xAxis.setLabelFont(addLabelsStyle.getFont());
        xAxis.setLabelPaint(addLabelsStyle.getColor());
    }

    NumberAxis yAxis = new NumberAxis(yLabel);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    if (yLowerBound != null && yUpperBound != null) {
        yAxis.setLowerBound(yLowerBound);
        yAxis.setUpperBound(yUpperBound);
    } else
        yAxis.setAutoRange(true);

    yAxis.setAxisLinePaint(Color.white);
    yAxis.setTickMarkPaint(Color.white);

    if (addLabelsStyle != null && addLabelsStyle.getFont() != null) {
        yAxis.setLabelFont(addLabelsStyle.getFont());
        yAxis.setLabelPaint(addLabelsStyle.getColor());
    }

    XYBlockRenderer renderer = new XYBlockRenderer();

    PaintScale paintScale = null;

    if (grayPaintScale) {
        paintScale = new GrayPaintScale(minScaleValue, maxScaleValue);
    } else {
        if (scaleLowerBound != null && scaleUpperBound != null) {
            paintScale = new LookupPaintScale(scaleLowerBound, scaleUpperBound, Color.gray);
        } else {
            paintScale = new LookupPaintScale(minScaleValue, maxScaleValue, Color.gray);
        }
        for (int i = 0; i < zRangeArray.length; i++) {
            ZRange zRange = zRangeArray[i];
            ((LookupPaintScale) paintScale).add(zRange.getValue().doubleValue(), zRange.getColor());

        }
    }

    renderer.setPaintScale(paintScale);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
    plot.setForegroundAlpha(0.66f);

    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();

    NumberAxis scaleAxis = new NumberAxis(zLabel);
    scaleAxis.setAxisLinePaint(Color.white);
    scaleAxis.setTickMarkPaint(Color.white);
    scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 7));
    if (scaleLowerBound != null && scaleUpperBound != null) {
        scaleAxis.setLowerBound(scaleLowerBound);
        scaleAxis.setUpperBound(scaleUpperBound);
    } else
        scaleAxis.setAutoRange(true);

    if (addLabelsStyle != null && addLabelsStyle.getFont() != null) {
        scaleAxis.setLabelFont(addLabelsStyle.getFont());
        scaleAxis.setLabelPaint(addLabelsStyle.getColor());
    }

    if (blockHeight != null && blockWidth != null) {
        renderer.setBlockWidth(blockWidth.doubleValue());
        renderer.setBlockHeight(blockHeight.doubleValue());
    }

    PaintScaleLegend legend = new PaintScaleLegend(paintScale, scaleAxis);
    legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    legend.setAxisOffset(5.0);
    legend.setMargin(new RectangleInsets(5, 5, 5, 5));
    legend.setFrame(new BlockBorder(Color.black));
    legend.setPadding(new RectangleInsets(10, 10, 10, 10));
    legend.setStripWidth(10);
    legend.setPosition(RectangleEdge.RIGHT);
    legend.setBackgroundPaint(color);

    chart.addSubtitle(legend);

    //      chart.setBackgroundPaint(new Color(180, 180, 250));   
    chart.setBackgroundPaint(color);

    logger.debug("OUT");
    return chart;
}

From source file:org.gumtree.vis.hist2d.Hist2D.java

private PaintScaleLegend createScaleLegend(PaintScale scale) {

    PaintScaleLegend legend = new PaintScaleLegend(scale, scaleAxis);
    legend.setSubdivisionCount(20);/*from  www .  j a  va  2 s.com*/
    legend.setStripOutlineVisible(false);
    legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    legend.setAxisOffset(5);
    RectangleInsets rec = new RectangleInsets(5, 0, 10, 5);
    legend.setMargin(rec);
    RectangleInsets rec2 = new RectangleInsets(4, 0, 22, 2);
    legend.setPadding(rec2);
    legend.setStripWidth(10);
    legend.setPosition(RectangleEdge.RIGHT);
    return legend;
}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputHeatmap.java

protected void resetRenderer(final IScope scope, final String serieid) {
    final XYBlockRenderer newr = (XYBlockRenderer) this.getOrCreateRenderer(scope, serieid);

    // newr.setSeriesStroke(0, new BasicStroke(0));
    final ChartDataSeries myserie = this.getChartdataset().getDataSeries(scope, serieid);

    if (myserie.getMycolor() != null) {
        newr.setSeriesPaint(0, myserie.getMycolor());
    }/*w w w.j av a2s. c o m*/
    if (myserie.getSValues(scope).size() > 0) {
        final double maxval = Collections.max(myserie.getSValues(scope));
        final double minval = Collections.min(myserie.getSValues(scope));
        Color cdeb = new Color(0, 0, 0, 0);
        if (myserie.getMyMincolor() != null)
            cdeb = myserie.getMyMincolor();
        Color cend = new Color(0.9f, 0.9f, 0.9f, 1.0f);
        if (myserie.getMycolor() != null)
            cend = myserie.getMycolor();

        LookupPaintScale paintscale = createLUT(100, (float) minval, (float) maxval, cdeb, cend);
        if (myserie.getMyMedcolor() != null)
            paintscale = createLUT(100, (float) minval, (float) maxval, cdeb, myserie.getMyMedcolor(), cend);

        newr.setPaintScale(paintscale);

        final NumberAxis scaleAxis = new NumberAxis(myserie.getName());
        scaleAxis.setAxisLinePaint(this.axesColor);
        scaleAxis.setTickMarkPaint(this.axesColor);
        scaleAxis.setTickLabelFont(this.getTickFont());
        scaleAxis.setRange(minval, maxval);
        scaleAxis.setAxisLinePaint(axesColor);
        scaleAxis.setLabelFont(getLabelFont());
        if (textColor != null) {
            scaleAxis.setLabelPaint(textColor);
            scaleAxis.setTickLabelPaint(textColor);
        }
        if (!this.getXTickValueVisible(scope)) {
            scaleAxis.setTickMarksVisible(false);
            scaleAxis.setTickLabelsVisible(false);

        }

        final PaintScaleLegend legend = new PaintScaleLegend(paintscale, scaleAxis);
        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.RIGHT);
        legend.setBackgroundPaint(this.backgroundColor);
        // ArrayList<PaintScaleLegend> caxe=new
        // ArrayList<PaintScaleLegend>();
        // caxe.add(legend);
        // chart.setSubtitles(caxe);
        if (!this.series_label_position.equals("none"))
            chart.addSubtitle(legend);

    }
}

From source file:org.glotaran.core.datadisplayers.multispec.MultiSpecEditorTopComponent.java

private void MakeImageChart(ColorCodedImageDataset dataset) {
    double range = Math.abs(data.getMaxInt() - data.getMinInt());
    double dataMin, dataMax;
    if (range == 0.0) {
        dataMin = data.getMinInt() - 0.1;
        dataMax = data.getMaxInt() + 0.1;
    } else {//www . ja v a  2  s .  c om
        dataMin = data.getMinInt();
        dataMax = data.getMaxInt();
    }
    PaintScale ps = new RainbowPaintScale(dataMin, dataMax);
    this.chartMultiSpec = createChart(new XYSeriesCollection());
    this.chartMultiSpec.setBackgroundPaint(JFreeChart.DEFAULT_BACKGROUND_PAINT);

    XYPlot tempPlot = (XYPlot) this.chartMultiSpec.getPlot();
    this.wholeXRange = tempPlot.getDomainAxis().getRange();
    this.wholeYRange = tempPlot.getRangeAxis().getRange();

    //added axes labeles on the image
    //        DecimalFormat formatter = new DecimalFormat("##0E0");
    //        NumberAxis xAxis = new NumberAxis("Wavelength  ");
    //
    //        
    //          double[] x2values = data.getIntenceImY();
    //        double x2range = Math.abs(x2values[0] - x2values[x2values.length - 1]);
    //        if (x2range<=0) {
    //            for (int i = 0; i < x2values.length; i++) {
    //                x2values[i]=i;
    //            }
    //        }
    //        
    //        int numberOfTicks = Math.min(data.getIntenceImY().length,MAX_NO_TICKS);
    //        NonLinearNumberTickUnit xTickUnit = new NonLinearNumberTickUnit(x2values.length/numberOfTicks, formatter,x2values);
    //        xAxis.setTickUnit(xTickUnit);
    //        xAxis.setTickLabelsVisible(true);
    //        tempPlot.setDomainAxis(xAxis);
    //        
    //        NumberAxis yAxis = new NumberAxis("? Wavelength");
    //
    //        formatter = new DecimalFormat("##0.#E0");
    //        numberOfTicks = Math.min(data.getX3().length,MAX_NO_TICKS);
    //         NonLinearNumberTickUnit yTickUnit = new NonLinearNumberTickUnit(data.getX3().length/numberOfTicks, formatter,data.getX3(),false);
    //        yAxis.setTickUnit(yTickUnit);
    //        yAxis.setTickLabelsVisible(true);
    //        tempPlot.setRangeAxis(yAxis);

    chartPanelMultiSpec = new HeightMapPanel(chartMultiSpec, true);
    chartPanelMultiSpec.setFillZoomRectangle(true);
    chartPanelMultiSpec.setMouseWheelEnabled(true);
    chartPanelMultiSpec.setZoomFillPaint(new Color(68, 68, 78, 63));
    jpMultiSpecImage.removeAll();
    //        chpanImage.setSize(jPSpecImage.getMaximumSize());
    jpMultiSpecImage.setLayout(new BorderLayout());

    ImageCrosshairLabelGenerator crossLabGenVerticalCut = new ImageCrosshairLabelGenerator(data.getIntenceImY(),
            false);
    ImageCrosshairLabelGenerator crossLabGenHorisontalCut = new ImageCrosshairLabelGenerator(
            data.getIntenceImX(), false);
    ImageCrosshairLabelGenerator crossLabGenTimeSlise = new ImageCrosshairLabelGenerator(data.getX(), false);

    crhVerticalCut = createCroshair(Color.red, crossLabGenVerticalCut);
    crhHorisontalCut = createCroshair(Color.gray, crossLabGenHorisontalCut);
    crhTimeSlice = createCroshair(Color.red, null);

    CrosshairOverlay overlay = new CrosshairOverlay();
    overlay.addDomainCrosshair(crhVerticalCut);
    overlay.addRangeCrosshair(crhHorisontalCut);
    chartPanelMultiSpec.addOverlay(overlay);
    jpMultiSpecImage.add(chartPanelMultiSpec);
    //TODO: auto scale the JSlider jSColum to the size of the chart
    //chpanImage.getChartRenderingInfo().getChartArea().getWidth();
    //jSColum.setBounds(jSColum.getBounds().x, jSColum.getBounds().y,(int)chpanImage.getChartRenderingInfo().getChartArea().getBounds().width,jSColum.getHeight());

    chartMultiSpec.addChangeListener((ChartChangeListener) this);

    subchartVerticalCutTrace = createXYPlot(PlotOrientation.HORIZONTAL, AxisLocation.BOTTOM_OR_RIGHT,
            data.getIntenceImX(), jpVerticalCut, false, null);
    subchartHorisontalTrace = createXYPlot(PlotOrientation.VERTICAL, AxisLocation.BOTTOM_OR_RIGHT,
            data.getIntenceImY(), jpHorisontalCut, false, null);

    CrosshairOverlay overlayTime = new CrosshairOverlay();
    overlayTime.addDomainCrosshair(crhTimeSlice);

    subchartTimeTrace = createXYPlot(PlotOrientation.VERTICAL, AxisLocation.BOTTOM_OR_LEFT, data.getX(),
            jpTimeeTrace, false, overlayTime);

    NumberAxis scaleAxis = new NumberAxis();
    scaleAxis.setAxisLinePaint(Color.black);
    scaleAxis.setTickMarkPaint(Color.black);
    scaleAxis.setRange(data.getMinInt(), data.getMaxInt());
    scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 12));
    PaintScaleLegend legend = new PaintScaleLegend(ps, scaleAxis);
    legend.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    legend.setMargin(new RectangleInsets(5, 5, 5, 5));
    legend.setStripWidth(15);
    legend.setPosition(RectangleEdge.RIGHT);
    legend.setBackgroundPaint(chartMultiSpec.getBackgroundPaint());
    chartMultiSpec.addSubtitle(legend);

    this.chartMultiSpec.addChangeListener((ChartChangeListener) this);
    jSVerticalCut.setValueIsAdjusting(true);
    jSVerticalCut.setMaximum(dataset.GetImageWidth() - 1);
    jSVerticalCut.setMinimum(0);
    //        jSVerticalCut.setValue(0);
    jSVerticalCut.setValueIsAdjusting(false);

    jsHorisontalCut.setValueIsAdjusting(true);
    jsHorisontalCut.setMaximum(dataset.GetImageHeigth() - 1);
    jsHorisontalCut.setMinimum(0);
    jsHorisontalCut.setValueIsAdjusting(false);

    jsTimeSlice.setValueIsAdjusting(true);
    jsTimeSlice.setMaximum(data.getNt() - 1);
    jsTimeSlice.setMinimum(0);
    jsTimeSlice.setValueIsAdjusting(false);

}

From source file:vteaexploration.plottools.panels.XYChartPanel.java

private ChartPanel createChart(int x, int y, int l, String xText, String yText, String lText,
        Color imageGateColor) {/*from   ww  w  .  j a  v a2s .  c  o m*/

    XYShapeRenderer renderer = new XYShapeRenderer();
    XYShapeRenderer rendererGate = new XYShapeRenderer();

    PaintScaleLegend psl = new PaintScaleLegend(new LookupPaintScale(0, 100, new Color(0, 0, 0)),
            new NumberAxis(""));

    if (l > 0) {
        double max = getMaximumOfData((ArrayList) plotValues.get(1), l);
        double min = this.getMinimumOfData((ArrayList) plotValues.get(1), l);
        double range = max - min;

        if (max == 0) {
            max = 1;
        }

        //System.out.println("PROFILING-DETAILS: Points to plot: " + ((ArrayList) plotValues.get(1)).size());
        LookupPaintScale ps = new LookupPaintScale(min, max + 100, new Color(0, 0, 0));

        renderer.setPaintScale(ps);

        ps.add(min, TENPERCENT);
        ps.add(min + (1 * (range / 10)), XYChartPanel.TENPERCENT);
        ps.add(min + (2 * (range / 10)), XYChartPanel.TWENTYPERCENT);
        ps.add(min + (3 * (range / 10)), XYChartPanel.THIRTYPERCENT);
        ps.add(min + (4 * (range / 10)), XYChartPanel.FORTYPERCENT);
        ps.add(min + (5 * (range / 10)), XYChartPanel.FIFTYPERCENT);
        ps.add(min + (6 * (range / 10)), XYChartPanel.SIXTYPERCENT);
        ps.add(min + (7 * (range / 10)), XYChartPanel.SEVENTYPERCENT);
        ps.add(min + (8 * (range / 10)), XYChartPanel.EIGHTYPERCENT);
        ps.add(min + (9 * (range / 10)), XYChartPanel.NINETYPERCENT);
        ps.add(max, XYChartPanel.ALLPERCENT);

        NumberAxis lAxis = new NumberAxis(lText);
        lAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

        psl = new PaintScaleLegend(ps, lAxis);
        psl.setBackgroundPaint(VTC._VTC.BACKGROUND);
        psl.setPosition(RectangleEdge.RIGHT);
        psl.setMargin(4, 4, 40, 4);
        psl.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

    } else {

        renderer.setBaseFillPaint(TENPERCENT);
    }

    Ellipse2D shape = new Ellipse2D.Double(0, 0, size, size);
    Ellipse2D shapeGate = new Ellipse2D.Double(-2, -2, size + 4, size + 4);

    renderer.setBaseShape(shape);

    rendererGate.setBaseShape(shapeGate);

    NumberAxis xAxis = new NumberAxis("");
    NumberAxis yAxis = new NumberAxis("");

    xAxis.setAutoRangeIncludesZero(false);
    yAxis.setAutoRangeIncludesZero(false);

    XYPlot plot = new XYPlot(createXYZDataset((ArrayList) plotValues.get(1), x, y, l), xAxis, yAxis, renderer);

    plot.getDomainAxis();
    plot.getRangeAxis();

    plot.setDomainPannable(false);
    plot.setRangePannable(false);

    plot.setRenderer(0, renderer);
    plot.setRenderer(1, rendererGate);

    plot.setDataset(0, createXYZDataset((ArrayList) plotValues.get(1), x, y, l));

    if (imageGate) {
        roiCreated(impoverlay);
        XYZDataset set = createXYZDataset(ImageGateOverlay, x, y, l);
        plot.setDataset(1, set);
        plot.setRenderer(1, new XYShapeRenderer() {
            @Override
            protected java.awt.Paint getPaint(XYDataset dataset, int series, int item) {
                return imageGateOutline;
            }

            @Override
            public Shape getItemShape(int row, int col) {
                return new Ellipse2D.Double(-2, -2, size + 4, size + 4);
            }
        });

    }
    //System.out.println("PROFILING: Generating plot with " + plot.getDatasetCount() + " datasets.");
    //System.out.println("PROFILING: Generating plot with " + ImageGateOverlay.size() + " objects gated.");

    try {
        if (getRangeofData((ArrayList) plotValues.get(1), x) > 16384) {
            LogAxis logAxisX = new LogAxis();
            logAxisX.setAutoRange(true);
            plot.setDomainAxis(logAxisX);
        }

        if (getRangeofData((ArrayList) plotValues.get(1), y) > 16384) {
            LogAxis logAxisY = new LogAxis();
            logAxisY.setAutoRange(true);
            plot.setRangeAxis(logAxisY);
        }
    } catch (NullPointerException e) {
    }
    ;

    JFreeChart chart = new JFreeChart("Plot of " + xText + " vs. " + yText, plot);

    chart.removeLegend();

    //LUT 
    if (l > 0)
        chart.addSubtitle(psl);

    //notifiyUpdatePlotWindowListeners();
    return new ChartPanel(chart, true, true, false, false, true);
}