Example usage for org.jfree.chart.plot XYPlot setOutlineVisible

List of usage examples for org.jfree.chart.plot XYPlot setOutlineVisible

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot setOutlineVisible.

Prototype

public void setOutlineVisible(boolean visible) 

Source Link

Document

Sets the flag that controls whether or not the plot's outline is drawn, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:it.eng.spagobi.engines.chart.bo.charttypes.targetcharts.SparkLine.java

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

    final JFreeChart sparkLineGraph = ChartFactory.createTimeSeriesChart(null, null, null, dataset, legend,
            false, false);/*ww  w .  j  a  v  a2 s. com*/
    sparkLineGraph.setBackgroundPaint(color);

    TextTitle title = setStyleTitle(name, styleTitle);
    sparkLineGraph.setTitle(title);
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        sparkLineGraph.addSubtitle(subTitle);
    }

    sparkLineGraph.setBorderVisible(false);
    sparkLineGraph.setBorderPaint(Color.BLACK);
    XYPlot plot = sparkLineGraph.getXYPlot();
    plot.setOutlineVisible(false);
    plot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0));
    plot.setBackgroundPaint(null);
    plot.setDomainGridlinesVisible(false);
    plot.setDomainCrosshairVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setRangeCrosshairVisible(false);
    plot.setBackgroundPaint(color);

    // calculate the last marker color
    Paint colorLast = getLastPointColor();

    // Calculate average, minimum and maximum to draw plot borders.
    boolean isFirst = true;
    double avg = 0, min = Double.POSITIVE_INFINITY, max = Double.NEGATIVE_INFINITY;
    int count = 0;
    for (int i = 0; i < timeSeries.getItemCount(); i++) {
        if (timeSeries.getValue(i) != null) {
            count++;
            if (isFirst) {
                min = timeSeries.getValue(i).doubleValue();
                max = timeSeries.getValue(i).doubleValue();
                isFirst = false;
            }
            double n = timeSeries.getValue(i).doubleValue();
            //calculate avg, min, max
            avg += n;
            if (n < min)
                min = n;
            if (n > max)
                max = n;
        }
    }
    // average
    avg = avg / (double) count;

    // calculate min and max between thresholds!
    boolean isFirst2 = true;
    double lb = 0, ub = 0;
    for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) {
        Double thres = (Double) iterator.next();
        if (isFirst2 == true) {
            ub = thres.doubleValue();
            lb = thres.doubleValue();
            isFirst2 = false;
        }
        if (thres.doubleValue() > ub)
            ub = thres.doubleValue();
        if (thres.doubleValue() < lb)
            lb = thres.doubleValue();
    }

    plot.getRangeAxis().setRange(new Range(Math.min(lb, min - 2), Math.max(ub, max + 2) + 2));

    addMarker(1, avg, Color.GRAY, 0.8f, plot);
    //addAvaregeSeries(series, plot);
    addPointSeries(timeSeries, plot);

    int num = 3;
    for (Iterator iterator = thresholds.keySet().iterator(); iterator.hasNext();) {
        Double thres = (Double) iterator.next();
        TargetThreshold targThres = thresholds.get(thres);
        Color color = Color.WHITE;
        if (targThres != null && targThres.getColor() != null) {
            color = targThres.getColor();
        }
        if (targThres.isVisible()) {
            addMarker(num++, thres.doubleValue(), color, 0.5f, plot);
        }
    }

    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setVisible(false);
    domainAxis.setUpperMargin(0.2);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setVisible(false);

    plot.getRenderer().setSeriesPaint(0, Color.BLACK);
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false) {
        public boolean getItemShapeVisible(int _series, int item) {
            TimeSeriesDataItem tsdi = timeSeries.getDataItem(item);
            if (tsdi == null)
                return false;
            Month period = (Month) tsdi.getPeriod();
            int currMonth = period.getMonth();
            int currYear = period.getYearValue();
            int lastMonthFilled = lastMonth.getMonth();
            int lastYearFilled = lastMonth.getYearValue();
            boolean isLast = false;
            if (currYear == lastYearFilled && currMonth == lastMonthFilled) {
                isLast = true;
            }
            return isLast;
        }
    };
    renderer.setSeriesPaint(0, Color.decode("0x000000"));

    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseFillPaint(colorLast);
    renderer.setBaseOutlinePaint(Color.BLACK);
    renderer.setUseOutlinePaint(true);
    renderer.setSeriesShape(0, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));

    if (wlt_mode.doubleValue() == 0) {
        renderer.setBaseItemLabelsVisible(Boolean.FALSE, true);
    } else {
        renderer.setBaseItemLabelsVisible(Boolean.TRUE, true);
        renderer.setBaseItemLabelFont(
                new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize()));
        renderer.setBaseItemLabelPaint(styleValueLabels.getColor());
        renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator("{2}", new DecimalFormat("0.###"),
                new DecimalFormat("0.###")) {
            public String generateLabel(CategoryDataset dataset, int row, int column) {
                if (dataset.getValue(row, column) == null || dataset.getValue(row, column).doubleValue() == 0)
                    return "";
                String columnKey = (String) dataset.getColumnKey(column);
                int separator = columnKey.indexOf('-');
                String month = columnKey.substring(0, separator);
                String year = columnKey.substring(separator + 1);
                int monthNum = Integer.parseInt(month);
                if (wlt_mode.doubleValue() >= 1 && wlt_mode.doubleValue() <= 4) {
                    if (wlt_mode.doubleValue() == 2 && column % 2 == 0)
                        return "";

                    Calendar calendar = Calendar.getInstance();
                    calendar.set(Calendar.MONTH, monthNum - 1);
                    SimpleDateFormat dataFormat = new SimpleDateFormat("MMM");
                    return dataFormat.format(calendar.getTime());
                } else
                    return "" + monthNum;
            }
        });
    }

    if (wlt_mode.doubleValue() == 3) {
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 2));
        renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 2));

    } else if (wlt_mode.doubleValue() == 4) {
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                org.jfree.ui.TextAnchor.BOTTOM_CENTER, org.jfree.ui.TextAnchor.BOTTOM_RIGHT, Math.PI / 4));
        renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                org.jfree.ui.TextAnchor.TOP_CENTER, org.jfree.ui.TextAnchor.HALF_ASCENT_LEFT, Math.PI / 4));
    }

    if (legend == true) {
        LegendItemCollection collection = createThresholdLegend(plot);
        LegendItem item = new LegendItem("Avg", "Avg", "Avg", "Avg", new Rectangle(10, 10), colorAverage);
        collection.add(item);
        plot.setFixedLegendItems(collection);

    }

    plot.setRenderer(0, renderer);
    logger.debug("OUT");
    return sparkLineGraph;
}

From source file:org.knime.knip.core.ui.imgviewer.panels.HistogramBC.java

private final void setBackgroundDefault(final JFreeChart chart) {
    final BasicStroke gridStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f,
            new float[] { 2.0f, 1.0f }, 0.0f);
    final XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlineStroke(gridStroke);
    plot.setDomainGridlineStroke(gridStroke);
    // Background of Histogram inside border
    //plot.setBackgroundPaint(new Color(235,235,235));
    plot.setBackgroundPaint(Color.white);
    // change from white to gray
    plot.setRangeGridlinePaint(Color.gray);
    plot.setDomainGridlinePaint(Color.gray);
    // set lines invisible
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    plot.setOutlineVisible(true);
    plot.getDomainAxis().setAxisLineVisible(false);
    plot.getRangeAxis().setAxisLineVisible(false);
    plot.getDomainAxis().setLabelPaint(Color.gray);
    plot.getRangeAxis().setLabelPaint(Color.gray);
    plot.getDomainAxis().setTickLabelPaint(Color.gray);
    plot.getRangeAxis().setTickLabelPaint(Color.gray);
    final TextTitle title = chart.getTitle();
    if (title != null) {
        title.setPaint(Color.black);
    }/*from ww  w  .  ja v  a 2 s  . c  om*/
}

From source file:org.projectforge.statistics.TimesheetDisciplineChartBuilder.java

private JFreeChart create(final TimeSeries series1, final TimeSeries series2, final Shape shape,
        final Stroke stroke, final boolean showAxisValues, final String valueAxisUnitKey) {
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series1);//from  w  w w.ja  v a  2  s. c om
    dataset.addSeries(series2);
    final JFreeChart chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL,
            true, true, false);

    final XYDifferenceRenderer renderer = new XYDifferenceRenderer(new Color(238, 176, 176),
            new Color(135, 206, 112), true);
    renderer.setSeriesPaint(0, new Color(222, 23, 33));
    renderer.setSeriesPaint(1, new Color(64, 169, 59));
    if (shape != null) {
        renderer.setSeriesShape(0, shape);
        renderer.setSeriesShape(1, shape);
    } else {
        final Shape none = new Rectangle();
        renderer.setSeriesShape(0, none);
        renderer.setSeriesShape(1, none);
    }
    renderer.setSeriesStroke(0, stroke);
    renderer.setSeriesStroke(1, stroke);
    renderer.setSeriesVisibleInLegend(0, false);
    renderer.setSeriesVisibleInLegend(1, false);
    final XYPlot plot = chart.getXYPlot();
    plot.setRenderer(renderer);
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    final DateAxis xAxis = new DateAxis();
    xAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    xAxis.setLowerMargin(0.0);
    xAxis.setUpperMargin(0.0);
    xAxis.setVisible(showAxisValues);
    plot.setDomainAxis(xAxis);
    final NumberAxis yAxis;
    if (showAxisValues == true) {
        yAxis = new NumberAxis(PFUserContext.getLocalizedString(valueAxisUnitKey));
    } else {
        yAxis = new NumberAxis();
    }
    yAxis.setVisible(showAxisValues);
    plot.setRangeAxis(yAxis);
    plot.setOutlineVisible(false);
    return chart;
}

From source file:org.jstockchart.plot.TimeseriesPlot.java

private XYPlot createPricePlot() {
    Font axisFont = new Font("Arial", 0, 12);
    Stroke stroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f,
            new float[] { 1.0f, 1.0f }, 1.0f);
    PriceArea priceArea = timeseriesArea.getPriceArea();
    Color averageColor = new Color(243, 182, 117);
    priceArea.setAverageColor(averageColor);
    priceArea.setPriceColor(Color.BLUE);
    TimeSeriesCollection priceDataset = new TimeSeriesCollection();
    priceDataset.addSeries(dataset.getPriceTimeSeries().getTimeSeries());
    if (priceArea.isAverageVisible()) {
        priceDataset.addSeries(dataset.getAverageTimeSeries().getTimeSeries());
    }/* w  ww  .  jav  a2s  .c om*/

    CentralValueAxis logicPriceAxis = priceArea.getLogicPriceAxis();

    logicPriceAxis.setTickCount(7);

    CFXNumberAxis priceAxis = new CFXNumberAxis(logicPriceAxis.getLogicTicks());
    priceAxis.setShowUD(true);
    priceAxis.setOpenPrice(logicPriceAxis.getCentralValue().doubleValue());
    priceAxis.setTickMarksVisible(false);
    XYLineAndShapeRenderer priceRenderer = new XYLineAndShapeRenderer(true, false);
    priceAxis.setUpperBound(logicPriceAxis.getUpperBound());
    priceAxis.setLowerBound(logicPriceAxis.getLowerBound());
    priceAxis.setAxisLineVisible(false);
    priceAxis.setTickLabelFont(axisFont);
    priceRenderer.setSeriesPaint(0, priceArea.getPriceColor());
    priceRenderer.setSeriesPaint(1, priceArea.getAverageColor());

    CFXNumberAxis rateAxis = new CFXNumberAxis(logicPriceAxis.getRatelogicTicks());
    rateAxis.setShowUD(true);
    rateAxis.setOpenPrice(logicPriceAxis.getCentralValue().doubleValue());
    rateAxis.setTickMarksVisible(false);
    ;
    rateAxis.setTickLabelFont(axisFont);
    rateAxis.setAxisLineVisible(false);
    rateAxis.setUpperBound(logicPriceAxis.getUpperBound());
    rateAxis.setLowerBound(logicPriceAxis.getLowerBound());
    XYPlot plot = new XYPlot(priceDataset, null, priceAxis, priceRenderer);
    plot.setBackgroundPaint(priceArea.getBackgroudColor());
    plot.setOrientation(priceArea.getOrientation());
    plot.setRangeAxisLocation(priceArea.getPriceAxisLocation());
    plot.setRangeMinorGridlinesVisible(false);

    Stroke outLineStroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f,
            new float[] { 1.0f, 1.0f }, 1.0f);
    Stroke gridLineStroke = new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.0f,
            new float[] { 2.0f, 2.0f }, 1.0f);

    plot.setRangeGridlineStroke(gridLineStroke);
    plot.setDomainGridlineStroke(gridLineStroke);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);
    plot.setOutlineVisible(true);
    plot.setOutlineStroke(outLineStroke);
    plot.setOutlinePaint(Color.BLACK);

    if (priceArea.isRateVisible()) {
        plot.setRangeAxis(1, rateAxis);
        plot.setRangeAxisLocation(1, priceArea.getRateAxisLocation());
        plot.setDataset(1, null);
        plot.mapDatasetToRangeAxis(1, 1);
    }

    if (priceArea.isMarkCentralValue()) {
        Number centralPrice = logicPriceAxis.getCentralValue();
        if (centralPrice != null) {
            plot.addRangeMarker(new ValueMarker(centralPrice.doubleValue(), priceArea.getCentralPriceColor(),
                    new BasicStroke()));
        }
    }
    return plot;
}

From source file:no.met.jtimeseries.chart.ChartPlotter.java

/**
 * Add arrow symobl to the chart. Specify height to follow value curve.
 * Plot in the middle of chart if height is null.
 * //from   www  .  java  2  s .c o m
 * @param direction
 *            The direction of arrow
 * @param height
 *            The followed height
 * @param offset
 *            The offset value to follow the height, value is between
 *            [-1,1]
 */
public void addArrowDirectionPlot(NumberPhenomenon direction, NumberPhenomenon height, double offset,
        PlotStyle plotStyle) {
    XYArrowRenderer arrowRender = new XYArrowRenderer();
    arrowRender.setSeriesVisibleInLegend(0, false);
    arrowRender.setSeriesPaint(0, plotStyle.getSeriesColor());

    ArrowDataset dataset = Utility.toChartArrowDataset(direction, height, offset);
    XYPlot arrowPlot = new XYPlot(dataset, plot.getDomainAxis(0), plotStyle.getNumberAxis(), arrowRender);
    arrowPlot.setRangeGridlinesVisible(false);
    arrowPlot.setOutlineVisible(false);

    plot.mapDatasetToRangeAxis(plotIndex, rangeAxisIndex);
    plot.setDataset(plotIndex, dataset);
    plot.setRenderer(plotIndex, arrowRender);

    plotIndex++;
    rangeAxisIndex++;
}

From source file:org.jstockchart.plot.TimeseriesPlot.java

private XYPlot createVolumePlot() {
    Font axisFont = new Font("Arial", 0, 12);
    Stroke stroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f,
            new float[] { 1.0f, 1.0f }, 1.0f);
    VolumeArea volumeArea = timeseriesArea.getVolumeArea();
    LogicNumberAxis logicVolumeAxis = volumeArea.getLogicVolumeAxis();
    Color volumeColor = new Color(86, 126, 160);
    volumeArea.setVolumeColor(volumeColor);
    CFXNumberAxis volumeAxis = new CFXNumberAxis(logicVolumeAxis.getLogicTicks());
    volumeAxis.setAxisLineVisible(false);
    volumeAxis.setCustomTickCount(2);//from   w  ww . java  2 s . c  o m
    volumeAxis.setTickLabelPaint(volumeColor);
    volumeAxis.setUpperBound(logicVolumeAxis.getUpperBound());
    volumeAxis.setTickLabelFont(axisFont);
    volumeAxis.setTickMarkStroke(stroke);
    volumeAxis.setLowerBound(logicVolumeAxis.getLowerBound());
    volumeAxis.setAutoRangeIncludesZero(true);
    XYAreaRenderer2 volumeRenderer = new XYAreaRenderer2();
    volumeRenderer.setSeriesPaint(0, volumeArea.getVolumeColor());
    //volumeRenderer.setShadowVisible(false);
    volumeRenderer.setSeriesStroke(0, stroke);
    volumeRenderer.setBaseStroke(stroke);
    XYPlot plot = new XYPlot(new TimeSeriesCollection(dataset.getVolumeTimeSeries()), null, volumeAxis,
            volumeRenderer);
    plot.setBackgroundPaint(volumeArea.getBackgroudColor());
    plot.setOrientation(volumeArea.getOrientation());
    plot.setRangeAxisLocation(volumeArea.getVolumeAxisLocation());
    plot.setRangeMinorGridlinesVisible(false);

    Stroke outLineStroke = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.CAP_SQUARE, 0.0f,
            new float[] { 1.0f, 1.0f }, 1.0f);
    Stroke gridLineStroke = new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.0f,
            new float[] { 2.0f, 2.0f }, 1.0f);
    // plot.setBackgroundPaint(Color.RED);
    plot.setRangeGridlineStroke(gridLineStroke);
    plot.setDomainGridlineStroke(gridLineStroke);
    plot.setRangeGridlinesVisible(true);
    plot.setDomainGridlinesVisible(true);
    plot.setOutlineVisible(true);
    plot.setOutlineStroke(outLineStroke);
    plot.setOutlinePaint(Color.black);
    plot.setRangeZeroBaselineVisible(true);
    return plot;
}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java

private JFreeChart updateBubbleChartChart(Set<QuantDiseaseGroupsComparison> selectedComparisonList) {

    if (userCustomizedComparison != null) {
        return updateBubbleChartChartWithCustUserData(selectedComparisonList);
    }//from   www  .  j  av  a2 s .c  o  m
    tooltipsProtNumberMap.clear();
    DefaultXYZDataset defaultxyzdataset = new DefaultXYZDataset();
    int counter = 0;
    int upper = -1;
    boolean significantOnly = this.Quant_Central_Manager.isSignificantOnly();

    for (QuantDiseaseGroupsComparison qc : selectedComparisonList) {
        if (significantOnly) {
            int upperCounter = 0;
            for (DiseaseGroupsComparisonsProteinLayout qp : qc.getComparProtsMap().values()) {
                if (qp == null) {
                    continue;
                }

                if (qp.getSignificantTrindCategory() == 2 || qp.getSignificantTrindCategory() == 5) {
                    continue;
                }

                upperCounter++;
            }
            if (upperCounter > upper) {
                upper = upperCounter;
            }

        } else {
            if (qc.getComparProtsMap() == null) {
                System.out.println("null qc " + qc.getComparisonHeader());

            }
            if (qc.getComparProtsMap().size() > upper) {
                upper = qc.getComparProtsMap().size();
            }
        }

    }

    final Map<Integer, Color[]> seriousColorMap = new HashMap<Integer, Color[]>();
    Color[] dataColor = new Color[] { Color.WHITE, new Color(0, 153, 0), new Color(0, 229, 132), stableColor,
            new Color(247, 119, 119), new Color(204, 0, 0), Color.WHITE };

    double[] yAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 };
    double[] xAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 };
    double[] widthValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 };
    double[][] seriesValuesI = { yAxisValueI, xAxisValueI, widthValueI };
    seriousColorMap.put(0, new Color[] { Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE,
            Color.WHITE, Color.WHITE });
    defaultxyzdataset.addSeries("   ", seriesValuesI);

    for (QuantDiseaseGroupsComparison qc : selectedComparisonList) {

        double[] tempWidthValue = new double[8];
        if (qc.getComparProtsMap() == null) {
            continue;
        }

        for (String key : qc.getComparProtsMap().keySet()) {
            qc.getComparProtsMap().get(key).updateLabelLayout();

            if (significantOnly && (qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 2
                    || qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 5)) {
                tempWidthValue[3] = 0;
                tempWidthValue[6] = 0;
            } else {
                tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory()
                        + 1] = tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory() + 1]
                                + 1;
            }
        }

        if (tempWidthValue[3] > 0 && tempWidthValue[3] >= 0) {
            stableColor = new Color(1, 141, 244);

        } else {
            stableColor = Color.decode("#b5babb");

        }

        tempWidthValue[3] = tempWidthValue[3] + tempWidthValue[6];
        tempWidthValue[6] = 0;
        dataColor[3] = stableColor;

        int length = 0;
        if (upper < 10) {
            upper = 10;
        }

        double[] tooltipNumbess = new double[tempWidthValue.length];
        System.arraycopy(tempWidthValue, 0, tooltipNumbess, 0, tempWidthValue.length);
        this.tooltipsProtNumberMap.put(qc.getComparisonHeader(), tooltipNumbess);
        for (int x = 0; x < tempWidthValue.length; x++) {
            if (tempWidthValue[x] > 0) {
                tempWidthValue[x] = scaleValues(tempWidthValue[x], upper, 2.5, 0.05);//Math.max(tempWidthValue[x] * 1.5 / upper, 0.05);
                length++;
            }

        }
        double[] yAxisValue = new double[length];
        double[] xAxisValue = new double[length];
        double[] widthValue = new double[length];
        Color[] serColorArr = new Color[length];
        length = 0;

        for (int x = 0; x < tempWidthValue.length; x++) {
            if (tempWidthValue[x] > 0) {
                xAxisValue[length] = x;
                yAxisValue[length] = counter + 1;
                widthValue[length] = tempWidthValue[x];
                serColorArr[length] = dataColor[x];
                length++;
            }

        }

        if (length == 1 && selectedComparisonList.size() == 1) {
            widthValue[0] = 1;
        }
        seriousColorMap.put(counter + 1, serColorArr);

        double[][] seriesValues = { yAxisValue, xAxisValue, widthValue };
        defaultxyzdataset.addSeries(qc.getComparisonHeader(), seriesValues);
        counter++;
    }
    double[] yAxisValueII = new double[0];
    double[] xAxisValueII = new double[0];
    double[] widthValueII = new double[0];
    seriousColorMap.put(counter + 1, new Color[] {});
    double[][] seriesValuesII = { yAxisValueII, xAxisValueII, widthValueII };
    defaultxyzdataset.addSeries(" ", seriesValuesII);

    final Color[] labelsColor = new Color[] { Color.LIGHT_GRAY, new Color(80, 183, 71), Color.LIGHT_GRAY,
            new Color(1, 141, 244), Color.LIGHT_GRAY, new Color(204, 0, 0), Color.LIGHT_GRAY };
    Font font = new Font("Verdana", Font.BOLD, 13);
    SymbolAxis yAxis = new SymbolAxis(null,
            new String[] { "  ", "Decreased", " ", "Equal", " ", "Increased", "  " }) {

        int i = 0;

        @Override
        public RectangleInsets getTickLabelInsets() {
            //                System.out.println("at ---- super.getTickLabelInsets() " + super.getTickLabelInsets());
            //                if (i == 0) {
            //                    i++;
            //                    return new RectangleInsets(-5, -5, 0, 0);
            //                }else                   
            //                
            return super.getTickLabelInsets(); //To change body of generated methods, choose Tools | Templates.
        }

        int x = 0;

        @Override
        public Paint getTickLabelPaint() {
            if (x >= labelsColor.length) {
                x = 0;
            }
            return labelsColor[x++];
        }
    };
    yAxis.setAutoRangeStickyZero(true);
    yAxis.setFixedAutoRange(8);
    yAxis.setTickLabelFont(font);
    yAxis.setGridBandsVisible(false);
    yAxis.setAxisLinePaint(Color.LIGHT_GRAY);
    yAxis.setTickMarksVisible(false);
    yAxis.setUpperBound(6);

    String[] xAxisLabels = new String[selectedComparisonList.size() + 2];
    int x = 0;
    xAxisLabels[x] = "";
    int maxLength = -1;
    //init labels color

    final Color[] diseaseGroupslabelsColor = new Color[selectedComparisonList.size() + 2];
    diseaseGroupslabelsColor[x] = Color.WHITE;
    x++;

    for (QuantDiseaseGroupsComparison comp : selectedComparisonList) {
        String header = comp.getComparisonHeader();
        String updatedHeader = header.split(" / ")[0].split("\n")[0] + " / "
                + header.split(" / ")[1].split("\n")[0] + "";

        xAxisLabels[x] = updatedHeader + " (" + comp.getDatasetIndexes().length + ")    ";
        if (xAxisLabels[x].length() > maxLength) {
            maxLength = xAxisLabels[x].length();
        }
        diseaseGroupslabelsColor[x] = diseaseColorMap.get(header.split(" / ")[0].split("\n")[1]);
        x++;

    }
    xAxisLabels[x] = "";
    diseaseGroupslabelsColor[x] = Color.WHITE;

    SymbolAxis xAxis;
    final boolean finalNum;
    finalNum = maxLength > 30 && selectedComparisonList.size() > 4;

    xAxis = new SymbolAxis(null, xAxisLabels) {

        int x = 0;

        @Override
        public Paint getTickLabelPaint() {
            if (x >= diseaseGroupslabelsColor.length) {
                x = 0;
            }
            return diseaseGroupslabelsColor[x++];
        }

        private final boolean localfinal = finalNum;

        @Override
        protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) {

            if (localfinal) {
                setVerticalTickLabels(localfinal);
                return super.refreshTicksHorizontal(g2, dataArea, edge);
            }
            List ticks = new java.util.ArrayList();
            Font tickLabelFont = getTickLabelFont();
            g2.setFont(tickLabelFont);
            double size = getTickUnit().getSize();
            int count = calculateVisibleTickCount();
            double lowestTickValue = calculateLowestVisibleTickValue();
            double previousDrawnTickLabelPos = 0.0;
            double previousDrawnTickLabelLength = 0.0;
            if (count <= ValueAxis.MAXIMUM_TICK_COUNT) {
                for (int i = 0; i < count; i++) {
                    double currentTickValue = lowestTickValue + (i * size);
                    double xx = valueToJava2D(currentTickValue, dataArea, edge);
                    String tickLabel;
                    NumberFormat formatter = getNumberFormatOverride();
                    if (formatter != null) {
                        tickLabel = formatter.format(currentTickValue) + "  ";
                    } else {
                        tickLabel = valueToString(currentTickValue) + "  ";
                    }
                    // avoid to draw overlapping tick labels
                    Rectangle2D bounds = TextUtilities.getTextBounds(tickLabel, g2, g2.getFontMetrics());
                    double tickLabelLength = isVerticalTickLabels() ? bounds.getHeight() : bounds.getWidth();
                    boolean tickLabelsOverlapping = false;
                    if (i > 0) {
                        double avgTickLabelLength = (previousDrawnTickLabelLength + tickLabelLength) / 2.0;
                        if (Math.abs(xx - previousDrawnTickLabelPos) < avgTickLabelLength) {
                            tickLabelsOverlapping = true;
                        }
                    }
                    if (tickLabelsOverlapping) {
                        setVerticalTickLabels(true);
                    } else {
                        // remember these values for next comparison
                        previousDrawnTickLabelPos = xx;
                        previousDrawnTickLabelLength = tickLabelLength;
                    }
                    TextAnchor anchor;
                    TextAnchor rotationAnchor;
                    double angle = 0.0;
                    if (isVerticalTickLabels()) {
                        anchor = TextAnchor.CENTER_RIGHT;
                        rotationAnchor = TextAnchor.CENTER_RIGHT;
                        if (edge == RectangleEdge.TOP) {
                            angle = 76.5;
                        } else {
                            angle = -76.5;
                        }
                    } else {
                        if (edge == RectangleEdge.TOP) {
                            anchor = TextAnchor.BOTTOM_CENTER;
                            rotationAnchor = TextAnchor.BOTTOM_CENTER;
                        } else {
                            anchor = TextAnchor.TOP_CENTER;
                            rotationAnchor = TextAnchor.TOP_CENTER;
                        }
                    }
                    Tick tick = new NumberTick(new Double(currentTickValue), tickLabel, anchor, rotationAnchor,
                            angle);

                    ticks.add(tick);
                }
            }
            return ticks;
        }
    };

    //        }
    xAxis.setTickLabelFont(font);
    xAxis.setTickLabelInsets(new RectangleInsets(2, 20, 2, 20));
    xAxis.setAutoRangeStickyZero(true);
    xAxis.setTickMarksVisible(false);
    xAxis.setUpperBound(diseaseGroupslabelsColor.length - 1);

    xAxis.setGridBandsVisible(false);
    xAxis.setAxisLinePaint(Color.LIGHT_GRAY);
    int scale = XYBubbleRenderer.SCALE_ON_RANGE_AXIS;

    XYItemRenderer xyitemrenderer = new XYBubbleRenderer(scale) {
        private int counter = 0;
        private int localSerious = -1;
        private final Map<Integer, Color[]> localSeriousColorMap = seriousColorMap;

        @Override
        public Paint getSeriesPaint(int series) {
            if (series != localSerious || isNewImge || localSeriousColorMap.get(series).length == counter) {
                counter = 0;
                isNewImge = false;
            }
            localSerious = series;
            Color c = localSeriousColorMap.get(series)[counter];
            counter++;

            return c;
        }

    };

    XYPlot xyplot = new XYPlot(defaultxyzdataset, xAxis, yAxis, xyitemrenderer) {

        @Override
        protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area, List ticks) {
            try {
                if (!ticks.isEmpty()) {
                    ticks.remove(0);
                }
                if (!ticks.isEmpty()) {
                    ticks.remove(ticks.size() - 1);
                }
            } catch (Exception e) {
            }
            super.drawRangeGridlines(g2, area, ticks); //To change body of generated methods, choose Tools | Templates.
        }

        //            private final Color[] labelsColor = new Color[]{new Color(0, 153, 0), new Color(0, 229, 132), new Color(1, 141, 244), new Color(255, 51, 51), new Color(204, 0, 0), Color.decode("#b5babb")};
        //
        //            private final Font font = new Font("Verdana", Font.PLAIN, 12);
        //            private final String[] labels = new String[]{"Decreased 100%", "Decreased <100% ", "Equal", " Increased <100%", "Increased 100%", "No Quant. Info."};
        //
        //            @Override
        //            public LegendItemCollection getLegendItems() {
        //                LegendItemCollection legendItemCollection = new LegendItemCollection();
        //                for (int i = 0; i < labelsColor.length; i++) {
        //                    LegendItem item = new LegendItem(labels[i], labelsColor[i]);
        //                    item.setLabelFont(font);
        //
        //                    legendItemCollection.add(item);
        //
        //                }
        //
        //                return legendItemCollection;//To change body of generated methods, choose Tools | Templates.
        //            }
    };

    JFreeChart generatedChart = new JFreeChart(xyplot) {

    };

    xyplot.setOutlineVisible(false);
    LegendTitle legend = generatedChart.getLegend();

    legend.setVisible(false);
    //        legend.setMargin(20, 0, 0, 0);
    ////        legend.setBorder(1, 1, 1, 1);
    //        legend.setFrame(new BlockBorder(1, 0, 1, 0, Color.LIGHT_GRAY));

    //        generatedChart.removeLegend();
    //        xyplot.setForegroundAlpha(0.65F);
    xyplot.setBackgroundPaint(Color.WHITE);

    generatedChart.setBackgroundPaint(Color.WHITE);

    generatedChart.setPadding(new RectangleInsets(0, 0, 0, 0));
    Quant_Central_Manager.setProteinsOverviewBubbleChart(generatedChart);
    //        exporter.writeChartToPDFFile(generatedChart, 595, 842, "bublechart.pdf");
    return generatedChart;

}

From source file:probe.com.view.body.quantdatasetsoverview.diseasegroupsfilters.ComparisonsSelectionOverviewBubbleChart.java

private JFreeChart updateBubbleChartChartWithCustUserData(
        Set<QuantDiseaseGroupsComparison> selectedComparisonList) {

    tooltipsProtNumberMap.clear();//from  ww w  .java2s .  c om
    DefaultXYZDataset defaultxyzdataset = new DefaultXYZDataset();
    int counter = 0;
    int upper = -1;
    boolean significantOnly = this.Quant_Central_Manager.isSignificantOnly();

    if (userCustomizedComparison.getComparProtsMap().size() > upper) {
        upper = userCustomizedComparison.getComparProtsMap().size();
    }

    for (QuantDiseaseGroupsComparison qc : selectedComparisonList) {
        if (significantOnly) {
            int upperCounter = 0;
            for (DiseaseGroupsComparisonsProteinLayout qp : qc.getComparProtsMap().values()) {
                if (qp == null) {
                    continue;
                }

                if (qp.getSignificantTrindCategory() == 2) {
                    continue;
                }

                upperCounter++;
            }
            if (upperCounter > upper) {
                upper = upperCounter;
            }

        } else {
            if (qc.getComparProtsMap() == null) {
                System.out.println("null qc " + qc.getComparisonHeader());

            }
            if (qc.getComparProtsMap().size() > upper) {
                upper = qc.getComparProtsMap().size();
            }
        }

    }

    final Map<Integer, Color[]> seriousColorMap = new HashMap<Integer, Color[]>();
    Color[] dataColor = new Color[] { Color.WHITE, new Color(0, 153, 0), new Color(0, 229, 132), stableColor,
            new Color(247, 119, 119), new Color(204, 0, 0), Color.WHITE };
    double[] tempWidthValue = new double[8];

    double[] yAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 };
    double[] xAxisValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 };
    double[] widthValueI = new double[] { 0, 0, 0, 0, 0, 0, 0 };
    double[][] seriesValuesI = { yAxisValueI, xAxisValueI, widthValueI };
    seriousColorMap.put(0, new Color[] { Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE,
            Color.WHITE, Color.WHITE });
    defaultxyzdataset.addSeries("   ", seriesValuesI);

    for (String key : userCustomizedComparison.getComparProtsMap().keySet()) {
        userCustomizedComparison.getComparProtsMap().get(key).updateLabelLayout();

        {
            tempWidthValue[userCustomizedComparison.getComparProtsMap().get(key).getSignificantTrindCategory()
                    + 1] = tempWidthValue[userCustomizedComparison.getComparProtsMap().get(key)
                            .getSignificantTrindCategory() + 1] + 1;
        }
    }
    int length = 0;
    if (upper < 10) {
        upper = 10;
    }
    double[] tooltipNumbess = new double[tempWidthValue.length];
    System.arraycopy(tempWidthValue, 0, tooltipNumbess, 0, tempWidthValue.length);
    this.tooltipsProtNumberMap.put(userCustomizedComparison.getComparisonHeader(), tooltipNumbess);
    for (int z = 0; z < tempWidthValue.length; z++) {
        if (tempWidthValue[z] > 0) {
            tempWidthValue[z] = scaleValues(tempWidthValue[z], upper, 2.5, 0.05);//Math.max(tempWidthValue[z] * 1.5 / upper, 0.05);
            length++;
        }

    }
    double[] yAxisValue = new double[length];
    double[] xAxisValue = new double[length];
    double[] widthValue = new double[length];
    Color[] serColorArr = new Color[length];
    length = 0;

    for (int z = 0; z < tempWidthValue.length; z++) {
        if (tempWidthValue[z] > 0) {
            xAxisValue[length] = z;
            yAxisValue[length] = counter + 1;
            widthValue[length] = tempWidthValue[z];
            serColorArr[length] = dataColor[z];
            length++;
        }

    }

    if (length == 1 && selectedComparisonList.size() == 1) {
        widthValue[0] = 1;
    }
    seriousColorMap.put(++counter, serColorArr);

    double[][] seriesValues = { yAxisValue, xAxisValue, widthValue };
    defaultxyzdataset.addSeries(userCustomizedComparison.getComparisonHeader(), seriesValues);

    for (QuantDiseaseGroupsComparison qc : selectedComparisonList) {

        tempWidthValue = new double[8];
        if (qc.getComparProtsMap() == null) {
            continue;
        }

        for (String key : qc.getComparProtsMap().keySet()) {
            qc.getComparProtsMap().get(key).updateLabelLayout();

            if (significantOnly && (qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 2
                    || qc.getComparProtsMap().get(key).getSignificantTrindCategory() == 5)) {
                tempWidthValue[3] = 0;
                tempWidthValue[6] = 0;
            } else {
                tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory()
                        + 1] = tempWidthValue[qc.getComparProtsMap().get(key).getSignificantTrindCategory() + 1]
                                + 1;
            }
        }
        if (tempWidthValue[3] > 0 && tempWidthValue[6] >= 0) {
            stableColor = new Color(1, 141, 244);

        } else {
            stableColor = Color.decode("#b5babb");
        }
        tempWidthValue[3] = tempWidthValue[3] + tempWidthValue[6];
        tempWidthValue[6] = 0;
        dataColor[3] = stableColor;
        length = 0;
        if (upper < 10) {
            upper = 10;
        }
        tooltipNumbess = new double[tempWidthValue.length];
        System.arraycopy(tempWidthValue, 0, tooltipNumbess, 0, tempWidthValue.length);
        this.tooltipsProtNumberMap.put(qc.getComparisonHeader(), tooltipNumbess);
        for (int x = 0; x < tempWidthValue.length; x++) {
            if (tempWidthValue[x] > 0) {
                tempWidthValue[x] = scaleValues(tempWidthValue[x], upper, 2.5, 0.05);//Math.max(tempWidthValue[z] * 1.5 / upper, 0.05);
                length++;
            }

        }
        yAxisValue = new double[length];
        xAxisValue = new double[length];
        widthValue = new double[length];
        serColorArr = new Color[length];
        length = 0;

        for (int x = 0; x < tempWidthValue.length; x++) {
            if (tempWidthValue[x] > 0) {
                xAxisValue[length] = x;
                yAxisValue[length] = counter + 1;
                widthValue[length] = tempWidthValue[x];
                serColorArr[length] = dataColor[x];
                length++;
            }

        }

        if (length == 1 && selectedComparisonList.size() == 1) {
            widthValue[0] = 1;
        }
        seriousColorMap.put(counter + 1, serColorArr);

        seriesValues = new double[][] { yAxisValue, xAxisValue, widthValue };
        defaultxyzdataset.addSeries(qc.getComparisonHeader(), seriesValues);

        counter++;
    }

    double[] yAxisValueII = new double[0];
    double[] xAxisValueII = new double[0];
    double[] widthValueII = new double[0];
    seriousColorMap.put(counter + 1, new Color[] {});
    double[][] seriesValuesII = { yAxisValueII, xAxisValueII, widthValueII };
    defaultxyzdataset.addSeries(" ", seriesValuesII);

    final Color[] labelsColor = new Color[] { Color.WHITE, new Color(80, 183, 71), Color.LIGHT_GRAY,
            new Color(1, 141, 244), Color.LIGHT_GRAY, new Color(204, 0, 0), Color.WHITE };
    Font font = new Font("Verdana", Font.BOLD, 13);
    SymbolAxis yAxis = new SymbolAxis(null,
            new String[] { "  ", "Decreased", " ", "Equal", " ", "Increased", "  " }) {
        int x = 0;

        @Override
        public Paint getTickLabelPaint() {
            if (x >= labelsColor.length) {
                x = 0;
            }
            return labelsColor[x++];
        }
    };

    yAxis.setAutoRangeStickyZero(true);
    yAxis.setFixedAutoRange(8);
    yAxis.setTickLabelFont(font);
    yAxis.setGridBandsVisible(false);
    yAxis.setAxisLinePaint(Color.LIGHT_GRAY);
    yAxis.setTickMarksVisible(false);
    yAxis.setUpperBound(6);

    String[] xAxisLabels = new String[selectedComparisonList.size() + 3];
    xAxisLabels[0] = "  ";
    final Color[] diseaseGroupslabelsColor = new Color[selectedComparisonList.size() + 3];
    int x = 0;
    int maxLength = -1;
    //init labels color

    String updatedHeader = userCustomizedComparison.getComparisonHeader().split(" / ")[0].split("\n")[0] + " / "
            + userCustomizedComparison.getComparisonHeader().split(" / ")[1].split("\n")[0] + "";
    diseaseGroupslabelsColor[0] = Color.WHITE;
    diseaseGroupslabelsColor[x + 1] = diseaseColorMap.get("UserData");
    xAxisLabels[x + 1] = updatedHeader + " (" + userCustomizedComparison.getDatasetIndexes().length + ")    ";
    if (xAxisLabels[x + 1].length() > maxLength) {
        maxLength = xAxisLabels[++x].length();
    }

    for (QuantDiseaseGroupsComparison comp : selectedComparisonList) {
        String header = comp.getComparisonHeader();
        updatedHeader = header.split(" / ")[0].split("\n")[0] + " / " + header.split(" / ")[1].split("\n")[0]
                + "";

        xAxisLabels[x + 1] = updatedHeader + " (" + comp.getDatasetIndexes().length + ")    ";
        if (xAxisLabels[x + 1].length() > maxLength) {
            maxLength = xAxisLabels[x + 1].length();
        }
        diseaseGroupslabelsColor[x + 1] = diseaseColorMap.get(header.split(" / ")[0].split("\n")[1]);
        x++;

    }
    xAxisLabels[x + 1] = "   ";

    SymbolAxis xAxis;
    final boolean finalNum;
    finalNum = maxLength > 30 && selectedComparisonList.size() > 4;

    xAxis = new SymbolAxis(null, xAxisLabels) {

        int x = 0;

        @Override
        public Paint getTickLabelPaint() {
            if (x >= diseaseGroupslabelsColor.length) {
                x = 0;
            }
            return diseaseGroupslabelsColor[x++];
        }

        private final boolean localfinal = finalNum;

        @Override
        protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) {

            if (localfinal) {
                setVerticalTickLabels(localfinal);
                return super.refreshTicksHorizontal(g2, dataArea, edge);
            }
            List ticks = new java.util.ArrayList();
            Font tickLabelFont = getTickLabelFont();
            g2.setFont(tickLabelFont);
            double size = getTickUnit().getSize();
            int count = calculateVisibleTickCount();
            double lowestTickValue = calculateLowestVisibleTickValue();
            double previousDrawnTickLabelPos = 0.0;
            double previousDrawnTickLabelLength = 0.0;
            if (count <= ValueAxis.MAXIMUM_TICK_COUNT) {
                for (int i = 0; i < count; i++) {
                    double currentTickValue = lowestTickValue + (i * size);
                    double xx = valueToJava2D(currentTickValue, dataArea, edge);
                    String tickLabel;
                    NumberFormat formatter = getNumberFormatOverride();
                    if (formatter != null) {
                        tickLabel = formatter.format(currentTickValue) + "  ";
                    } else {
                        tickLabel = valueToString(currentTickValue) + "  ";
                    }
                    // avoid to draw overlapping tick labels
                    Rectangle2D bounds = TextUtilities.getTextBounds(tickLabel, g2, g2.getFontMetrics());
                    double tickLabelLength = isVerticalTickLabels() ? bounds.getHeight() : bounds.getWidth();
                    boolean tickLabelsOverlapping = false;
                    if (i > 0) {
                        double avgTickLabelLength = (previousDrawnTickLabelLength + tickLabelLength) / 2.0;
                        if (Math.abs(xx - previousDrawnTickLabelPos) < avgTickLabelLength) {
                            tickLabelsOverlapping = true;
                        }
                    }
                    if (tickLabelsOverlapping) {
                        setVerticalTickLabels(true);
                    } else {
                        // remember these values for next comparison
                        previousDrawnTickLabelPos = xx;
                        previousDrawnTickLabelLength = tickLabelLength;
                    }
                    TextAnchor anchor;
                    TextAnchor rotationAnchor;
                    double angle = 0.0;
                    if (isVerticalTickLabels()) {
                        anchor = TextAnchor.CENTER_RIGHT;
                        rotationAnchor = TextAnchor.CENTER_RIGHT;
                        if (edge == RectangleEdge.TOP) {
                            angle = 76.5;
                        } else {
                            angle = -76.5;
                        }
                    } else {
                        if (edge == RectangleEdge.TOP) {
                            anchor = TextAnchor.BOTTOM_CENTER;
                            rotationAnchor = TextAnchor.BOTTOM_CENTER;
                        } else {
                            anchor = TextAnchor.TOP_CENTER;
                            rotationAnchor = TextAnchor.TOP_CENTER;
                        }
                    }
                    Tick tick = new NumberTick(new Double(currentTickValue), tickLabel, anchor, rotationAnchor,
                            angle);

                    ticks.add(tick);
                }
            }
            return ticks;
        }
    };

    //        }
    xAxis.setTickLabelFont(font);
    xAxis.setTickLabelInsets(new RectangleInsets(2, 20, 2, 20));
    xAxis.setAutoRangeStickyZero(true);
    xAxis.setAutoRangeStickyZero(true);
    xAxis.setTickMarksVisible(false);
    xAxis.setUpperBound(diseaseGroupslabelsColor.length - 1);
    xAxis.setGridBandsVisible(false);
    xAxis.setAxisLinePaint(Color.LIGHT_GRAY);
    int scale = XYBubbleRenderer.SCALE_ON_RANGE_AXIS;

    XYItemRenderer xyitemrenderer = new XYBubbleRenderer(scale) {
        private int counter = 0;
        private int localSerious = -1;
        private final Map<Integer, Color[]> localSeriousColorMap = seriousColorMap;

        @Override
        public Paint getSeriesPaint(int series) {
            if (series != localSerious || isNewImge || localSeriousColorMap.get(series).length == counter) {
                counter = 0;
                isNewImge = false;
            }
            localSerious = series;
            Color c = localSeriousColorMap.get(series)[counter];
            counter++;

            return c;
        }

    };

    XYPlot xyplot = new XYPlot(defaultxyzdataset, xAxis, yAxis, xyitemrenderer) {
        @Override
        protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area, List ticks) {
            try {
                if (!ticks.isEmpty()) {
                    ticks.remove(0);
                }
                if (!ticks.isEmpty()) {
                    ticks.remove(ticks.size() - 1);
                }
            } catch (Exception e) {
            }
            super.drawRangeGridlines(g2, area, ticks); //To change body of generated methods, choose Tools | Templates.
        }

        //            private final Color[] labelsColor = new Color[]{new Color(0, 153, 0), new Color(0, 229, 132), new Color(1, 141, 244), new Color(255, 51, 51), new Color(204, 0, 0), Color.decode("#b5babb")};
        //
        //            private final Font font = new Font("Verdana", Font.PLAIN, 12);
        //            private final String[] labels = new String[]{"Decreased 100%", "Decreased <100% ", "Equal", " Increased <100%", "Increased 100%", "No Quant. Info."};
        //
        //            @Override
        //            public LegendItemCollection getLegendItems() {
        //                LegendItemCollection legendItemCollection = new LegendItemCollection();
        //                for (int i = 0; i < labelsColor.length; i++) {
        //                    LegendItem item = new LegendItem(labels[i], labelsColor[i]);
        //                    item.setLabelFont(font);
        //                    legendItemCollection.add(item);
        //
        //                }
        //
        //                return legendItemCollection;//To change body of generated methods, choose Tools | Templates.
        //            }
    };

    JFreeChart generatedChart = new JFreeChart(xyplot) {

    };
    xyplot.setOutlineVisible(false);
    LegendTitle legend = generatedChart.getLegend();
    legend.setVisible(false);
    xyplot.setBackgroundPaint(Color.WHITE);
    generatedChart.setBackgroundPaint(Color.WHITE);
    generatedChart.setPadding(new RectangleInsets(0, 0, 0, 0));
    Quant_Central_Manager.setProteinsOverviewBubbleChart(generatedChart);
    return generatedChart;

}