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

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

Introduction

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

Prototype

public void setRangeGridlineStroke(Stroke stroke) 

Source Link

Document

Sets the stroke for the grid lines plotted against the range axis, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java

@Override
protected void configurePlot(Plot plot, JRChartPlot jrPlot) {

    super.configurePlot(plot, jrPlot);

    if (plot instanceof CategoryPlot) {
        CategoryPlot categoryPlot = (CategoryPlot) plot;
        CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
        CategoryDataset categoryDataset = categoryPlot.getDataset();
        if (categoryDataset != null) {
            for (int i = 0; i < categoryDataset.getRowCount(); i++) {
                categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            }/*from   ww w.  j  a va 2  s.co m*/
        }
        categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
        categoryPlot.setRangeGridlineStroke(new BasicStroke(0.5f));
        categoryPlot.setDomainGridlinesVisible(false);
        categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    } else if (plot instanceof XYPlot) {
        XYPlot xyPlot = (XYPlot) plot;
        XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
        XYDataset xyDataset = xyPlot.getDataset();
        if (xyDataset != null) {
            for (int i = 0; i < xyDataset.getSeriesCount(); i++) {
                xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            }
        }
        xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
        xyPlot.setRangeGridlineStroke(new BasicStroke(0.5f));
        xyPlot.setDomainGridlinesVisible(false);
        xyPlot.setRangeZeroBaselineVisible(true);
    }
}

From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java

protected JFreeChart createScatterChart() throws JRException {
    JFreeChart jfreeChart = super.createScatterChart();
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();

    xyPlot.setRangeGridlinePaint(SCATTER_GRIDLINE_COLOR);
    xyPlot.setRangeGridlineStroke(new BasicStroke(0.75f));
    xyPlot.setDomainGridlinesVisible(true);
    xyPlot.setDomainGridlinePaint(SCATTER_GRIDLINE_COLOR);
    xyPlot.setDomainGridlineStroke(new BasicStroke(0.75f));
    xyPlot.setRangeZeroBaselinePaint(ChartThemesConstants.GRAY_PAINT_134);

    XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) xyPlot.getRenderer();
    lineRenderer.setUseFillPaint(true);//from  w w w.ja  v  a 2 s  .com
    JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
    boolean isShowLines = scatterPlot.getShowLines() == null ? false
            : scatterPlot.getShowLines().booleanValue();
    lineRenderer.setBaseLinesVisible(isShowLines);
    XYDataset xyDataset = xyPlot.getDataset();
    if (xyDataset != null) {
        for (int i = 0; i < xyDataset.getSeriesCount(); i++) {
            lineRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            lineRenderer.setSeriesFillPaint(i,
                    (Paint) ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
            lineRenderer.setSeriesPaint(i, (Paint) ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(i));
            //lineRenderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 6, 6));
        }
    }
    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.spring.EyeCandySixtiesChartTheme.java

@Override
protected JFreeChart createScatterChart() throws JRException {
    JFreeChart jfreeChart = super.createScatterChart();
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();

    xyPlot.setRangeGridlinePaint(SCATTER_GRIDLINE_COLOR);
    xyPlot.setRangeGridlineStroke(new BasicStroke(0.75f));
    xyPlot.setDomainGridlinesVisible(true);
    xyPlot.setDomainGridlinePaint(SCATTER_GRIDLINE_COLOR);
    xyPlot.setDomainGridlineStroke(new BasicStroke(0.75f));
    xyPlot.setRangeZeroBaselinePaint(ChartThemesConstants.GRAY_PAINT_134);

    XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) xyPlot.getRenderer();
    lineRenderer.setUseFillPaint(true);/*from   w  w w. j  a  v a 2s. co  m*/
    JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
    boolean isShowLines = scatterPlot.getShowLines() == null ? false : scatterPlot.getShowLines();
    lineRenderer.setBaseLinesVisible(isShowLines);
    XYDataset xyDataset = xyPlot.getDataset();
    if (xyDataset != null) {
        for (int i = 0; i < xyDataset.getSeriesCount(); i++) {
            lineRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            lineRenderer.setSeriesFillPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
            lineRenderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(i));
            //lineRenderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 6, 6));
        }
    }
    return jfreeChart;
}

From source file:ucar.unidata.idv.control.chart.PlotWrapper.java

/**
 * Utility to init xy plots// w w w .  j  a  v a2s  . c o m
 *
 * @param plot the plotx
 */
protected void initXYPlot(XYPlot plot) {
    plot.setBackgroundPaint(dataAreaColor);
    //        plot.setAxisOffset(new RectangleInsets(6.0, 3.0, 3.0, 3.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    plot.setDomainGridlinesVisible(domainLineState.getVisible());
    plot.setRangeGridlinesVisible(rangeLineState.getVisible());
    plot.setDomainGridlinePaint(domainLineState.getColor());
    plot.setRangeGridlinePaint(rangeLineState.getColor());
    plot.setDomainGridlineStroke(domainLineState.getStroke());
    plot.setRangeGridlineStroke(rangeLineState.getStroke());
}

From source file:org.gwaspi.gui.reports.SampleQAHetzygPlotZoom.java

private JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createScatterPlot("Heterozygosity vs. Missing Ratio",
            "Heterozygosity Ratio", "Missing Ratio", dataset, PlotOrientation.VERTICAL, true, false, false);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setNoDataMessage("NO DATA");
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);

    // CHART BACKGROUD COLOR
    chart.setBackgroundPaint(Color.getHSBColor(0.1f, 0.1f, 1.0f)); // Hue, saturation, brightness
    plot.setBackgroundPaint(PLOT_MANHATTAN_BACKGROUND); // Hue, saturation, brightness 9

    // GRIDLINES//from w w w .  ja  va2s. c  o m
    plot.setDomainGridlineStroke(new BasicStroke(0.0f));
    plot.setDomainMinorGridlineStroke(new BasicStroke(0.0f));
    plot.setDomainGridlinePaint(PLOT_MANHATTAN_BACKGROUND.darker().darker()); // Hue, saturation, brightness 7
    plot.setDomainMinorGridlinePaint(PLOT_MANHATTAN_BACKGROUND); // Hue, saturation, brightness 9
    plot.setRangeGridlineStroke(new BasicStroke(0.0f));
    plot.setRangeMinorGridlineStroke(new BasicStroke(0.0f));
    plot.setRangeGridlinePaint(PLOT_MANHATTAN_BACKGROUND.darker().darker()); // Hue, saturation, brightness 7
    plot.setRangeMinorGridlinePaint(PLOT_MANHATTAN_BACKGROUND.darker()); // Hue, saturation, brightness 8

    plot.setDomainMinorGridlinesVisible(true);
    plot.setRangeMinorGridlinesVisible(true);

    // DOTS RENDERER
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, PLOT_MANHATTAN_DOTS);
    //      renderer.setSeriesOutlinePaint(0, Color.DARK_GRAY);
    //      renderer.setUseOutlinePaint(true);
    // Set dot shape of the currently appended Series
    renderer.setSeriesShape(0, new Rectangle2D.Double(-1, -1, 2, 2));

    renderer.setSeriesVisibleInLegend(0, false);

    // AXIS
    double maxHetzy = 0.005;
    for (int i = 0; i < dataset.getItemCount(0); i++) {
        if (maxHetzy < dataset.getXValue(0, i)) {
            maxHetzy = dataset.getXValue(0, i);
        }
    }
    NumberAxis hetzyAxis = (NumberAxis) plot.getDomainAxis();
    hetzyAxis.setAutoRangeIncludesZero(true);
    hetzyAxis.setAxisLineVisible(true);
    hetzyAxis.setTickLabelsVisible(true);
    hetzyAxis.setTickMarksVisible(true);
    hetzyAxis.setRange(0, maxHetzy * 1.1);

    double maxMissrat = 0.005;
    for (int i = 0; i < dataset.getItemCount(0); i++) {
        if (maxMissrat < dataset.getYValue(0, i)) {
            maxMissrat = dataset.getYValue(0, i);
        }
    }
    NumberAxis missratAxis = (NumberAxis) plot.getRangeAxis();
    missratAxis.setAutoRangeIncludesZero(true);
    missratAxis.setAxisLineVisible(true);
    missratAxis.setTickLabelsVisible(true);
    missratAxis.setTickMarksVisible(true);
    missratAxis.setRange(0, maxMissrat * 1.1);

    // Add significance Threshold to subplot
    final Marker missingThresholdLine = new ValueMarker(missingThreshold);
    missingThresholdLine.setPaint(Color.blue);

    final Marker hetzyThresholdLine = new ValueMarker(hetzyThreshold);
    hetzyThresholdLine.setPaint(Color.blue);

    // Add legend to hetzyThreshold
    hetzyThresholdLine.setLabel("hetzyg. threshold = " + hetzyThreshold);
    missingThresholdLine.setLabel("missing. threshold = " + missingThreshold);
    hetzyThresholdLine.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    hetzyThresholdLine.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
    missingThresholdLine.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
    missingThresholdLine.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    plot.addRangeMarker(missingThresholdLine); // THIS FOR MISSING RATIO
    plot.addDomainMarker(hetzyThresholdLine); // THIS FOR HETZY RATIO

    // Marker label if below hetzyThreshold
    XYItemRenderer lblRenderer = plot.getRenderer();

    // THRESHOLD AND SELECTED LABEL GENERATOR
    MySeriesItemLabelGenerator lblGenerator = new MySeriesItemLabelGenerator(hetzyThreshold, missingThreshold);
    lblRenderer.setSeriesItemLabelGenerator(0, lblGenerator);
    lblRenderer.setSeriesItemLabelFont(0, new Font("SansSerif", Font.PLAIN, 10));
    lblRenderer.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER,
            TextAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, 2 * Math.PI));

    // TOOLTIP GENERATOR
    MyXYToolTipGenerator tooltipGenerator = new MyXYToolTipGenerator();

    lblRenderer.setBaseToolTipGenerator(tooltipGenerator);

    lblRenderer.setSeriesItemLabelsVisible(0, true);

    return chart;
}

From source file:org.gwaspi.gui.reports.ManhattanPlotZoom.java

private JFreeChart createChart(XYDataset dataset, ChromosomeKey chr) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, "", "P value", dataset, PlotOrientation.VERTICAL,
            true, false, false);/*w ww .j  av  a 2  s .c om*/

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setNoDataMessage("NO DATA");
    plot.setDomainZeroBaselineVisible(true);
    plot.setRangeZeroBaselineVisible(true);

    // CHART BACKGROUD COLOR
    chart.setBackgroundPaint(Color.getHSBColor(0.1f, 0.1f, 1.0f)); // Hue, saturation, brightness
    plot.setBackgroundPaint(manhattan_back); // Hue, saturation, brightness 9

    // GRIDLINES
    plot.setDomainGridlineStroke(new BasicStroke(0.0f));
    plot.setDomainMinorGridlineStroke(new BasicStroke(0.0f));
    plot.setDomainGridlinePaint(manhattan_back.darker().darker()); // Hue, saturation, brightness 7
    plot.setDomainMinorGridlinePaint(manhattan_back); // Hue, saturation, brightness 9
    plot.setRangeGridlineStroke(new BasicStroke(0.0f));
    plot.setRangeMinorGridlineStroke(new BasicStroke(0.0f));
    plot.setRangeGridlinePaint(manhattan_back.darker().darker()); // Hue, saturation, brightness 7
    plot.setRangeMinorGridlinePaint(manhattan_back.darker()); // Hue, saturation, brightness 8

    plot.setDomainMinorGridlinesVisible(true);
    plot.setRangeMinorGridlinesVisible(true);

    // DOTS RENDERER
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, manhattan_dot);
    //      renderer.setSeriesOutlinePaint(0, Color.DARK_GRAY);
    //      renderer.setUseOutlinePaint(true);
    // Set dot shape of the currently appended Series
    renderer.setSeriesShape(0, new Rectangle2D.Double(0.0, 0.0, 2, 2));

    renderer.setSeriesVisibleInLegend(0, false);

    NumberAxis positionAxis = (NumberAxis) plot.getDomainAxis();
    //      domainAxis.setAutoRangeIncludesZero(false);
    //      domainAxis.setTickMarkInsideLength(2.0f);
    //      domainAxis.setTickMarkOutsideLength(2.0f);
    //      domainAxis.setMinorTickCount(2);
    //      domainAxis.setMinorTickMarksVisible(true);
    positionAxis.setLabelAngle(1.0);
    positionAxis.setAutoRangeIncludesZero(false);
    positionAxis.setAxisLineVisible(true);
    positionAxis.setTickLabelsVisible(true);
    positionAxis.setTickMarksVisible(true);

    // ADD INVERSE LOG(10) Y AXIS
    LogAxis logPAxis = new LogAxis("P value");
    logPAxis.setBase(10);
    logPAxis.setInverted(true);
    logPAxis.setNumberFormatOverride(GenericReportGenerator.FORMAT_P_VALUE);

    logPAxis.setTickMarkOutsideLength(2.0f);
    logPAxis.setMinorTickCount(2);
    logPAxis.setMinorTickMarksVisible(true);
    logPAxis.setAxisLineVisible(true);
    logPAxis.setUpperMargin(0);

    TickUnitSource units = NumberAxis.createIntegerTickUnits();
    logPAxis.setStandardTickUnits(units);
    plot.setRangeAxis(0, logPAxis);

    // Add significance Threshold to subplot
    //threshold = 0.5/rdMatrixMetadata.getMarkerSetSize();  // (0.05/10? SNPs => 5*10-?)
    final Marker thresholdLine = new ValueMarker(threshold);
    thresholdLine.setPaint(Color.red);
    // Add legend to threshold
    thresholdLine.setLabel("P = " + GenericReportGenerator.FORMAT_P_VALUE.format(threshold));
    thresholdLine.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
    thresholdLine.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
    plot.addRangeMarker(thresholdLine);

    // Marker label if below threshold
    XYItemRenderer lblRenderer = plot.getRenderer();

    // THRESHOLD AND SELECTED LABEL GENERATOR
    MySeriesItemLabelGenerator lblGenerator = new MySeriesItemLabelGenerator(threshold, chr);
    lblRenderer.setSeriesItemLabelGenerator(0, lblGenerator);
    lblRenderer.setSeriesItemLabelFont(0, new Font("SansSerif", Font.PLAIN, 12));
    lblRenderer.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER,
            TextAnchor.TOP_LEFT, TextAnchor.BOTTOM_LEFT, Math.PI / 4.0));

    // TOOLTIP GENERATOR
    MyXYToolTipGenerator tooltipGenerator = new MyXYToolTipGenerator(chr);

    lblRenderer.setBaseToolTipGenerator(tooltipGenerator);

    lblRenderer.setSeriesItemLabelsVisible(0, true);

    return chart;
}

From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java

/**
 *
 *///  w  w w  .  ja  va  2  s  .c om
protected void configurePlot(Plot plot, JRChartPlot jrPlot) {
    super.configurePlot(plot, jrPlot);
    if (plot instanceof CategoryPlot) {
        CategoryPlot categoryPlot = (CategoryPlot) plot;
        CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
        CategoryDataset categoryDataset = categoryPlot.getDataset();
        if (categoryDataset != null) {
            for (int i = 0; i < categoryDataset.getRowCount(); i++) {
                categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            }
        }
        categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
        categoryPlot.setRangeGridlineStroke(new BasicStroke(1f));
        categoryPlot.setDomainGridlinesVisible(false);

    } else if (plot instanceof XYPlot) {
        XYPlot xyPlot = (XYPlot) plot;
        XYDataset xyDataset = xyPlot.getDataset();
        if (xyDataset != null) {
            XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
            for (int i = 0; i < xyDataset.getSeriesCount(); i++) {
                xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            }
        }
        xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
        xyPlot.setRangeGridlineStroke(new BasicStroke(1f));
        xyPlot.setDomainGridlinesVisible(false);

        xyPlot.setRangeZeroBaselineVisible(true);

    }
}

From source file:net.sf.jasperreports.chartthemes.spring.EyeCandySixtiesChartTheme.java

@Override
protected void configurePlot(Plot plot, JRChartPlot jrPlot) {
    super.configurePlot(plot, jrPlot);
    if (plot instanceof CategoryPlot) {
        CategoryPlot categoryPlot = (CategoryPlot) plot;
        CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
        CategoryDataset categoryDataset = categoryPlot.getDataset();
        if (categoryDataset != null) {
            for (int i = 0; i < categoryDataset.getRowCount(); i++) {
                categoryRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            }/*from w ww.ja v  a 2  s. co m*/
        }
        categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
        categoryPlot.setRangeGridlineStroke(new BasicStroke(1f));
        categoryPlot.setDomainGridlinesVisible(false);

    } else if (plot instanceof XYPlot) {
        XYPlot xyPlot = (XYPlot) plot;
        XYDataset xyDataset = xyPlot.getDataset();
        if (xyDataset != null) {
            XYItemRenderer xyItemRenderer = xyPlot.getRenderer();
            for (int i = 0; i < xyDataset.getSeriesCount(); i++) {
                xyItemRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
            }
        }
        xyPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
        xyPlot.setRangeGridlineStroke(new BasicStroke(1f));
        xyPlot.setDomainGridlinesVisible(false);

        xyPlot.setRangeZeroBaselineVisible(true);

    }
}

From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java

public static void customizeXYPlot(XYPlot plot, ChartParams params) {
    customizePlot(plot, params);/*from  ww w  .  j  a v a  2s  .  c  o  m*/

    if (params.get(ChartParams.XYPLOT_ORIENTATION) != null) {
        plot.setOrientation(params.getPlotOrientation(ChartParams.XYPLOT_ORIENTATION));
    }

    if (params.get(ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX) != null) {
        if (params.getBoolean(ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX)
                .booleanValue()) {
            plot.setDomainGridlinesVisible(true);
            if (params.get(
                    ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX) != null) {
                plot.setDomainGridlinePaint(params.getColor(
                        ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX));
            }

            if (params.get(
                    ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX) != null) {
                plot.setDomainGridlineStroke(params.getStroke(
                        ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX));
            }
        } else {
            plot.setDomainGridlinesVisible(false);
        }
    }

    if (params.get(ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX) != null) {
        if (params.getBoolean(ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX)
                .booleanValue()) {
            plot.setRangeGridlinesVisible(true);
            if (params.get(
                    ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX) != null) {
                plot.setRangeGridlinePaint(params.getColor(
                        ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX));
            }

            if (params.get(
                    ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX) != null) {
                plot.setRangeGridlineStroke(params.getStroke(
                        ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX));
            }
        } else {
            plot.setRangeGridlinesVisible(false);
        }
    }

    if (params.get(ChartParams.XYPLOT_QUADRANT_ORIGIN) != null) {
        plot.setQuadrantOrigin(params.getPoint2D(ChartParams.XYPLOT_QUADRANT_ORIGIN));
    }

    if (params.get(ChartParams.XYPLOT_QUADRANT_COLORS) != null) {
        List colors = params.getList(ChartParams.XYPLOT_QUADRANT_COLORS);
        for (int i = 0; i < 4 && i < colors.size(); i++) {
            if (colors.get(i) != null) {
                plot.setQuadrantPaint(i, (Color) colors.get(i));
            }
        }
    }
}

From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHandler.java

protected void customizeXYPlot(ChartPanel chartPanel, ChartDefinition cd, XYPlot plot) {
    PlotInformation pi = cd.getPlotInformation();

    customizeBasicPlot(plot, pi);//from  ww w  .  j  a v  a2 s  . c  o  m
    plot.clearRangeMarkers();
    plot.clearDomainMarkers();

    PlotOrientation po = cd.isVertical() ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL;

    plot.setOrientation(po);

    boolean showGrid = (pi == null) ? true : pi.isShowGridLines();

    if (showGrid) {
        Color c = getGridColor(pi);
        UIStroke stroke = getGridStroke(pi);

        plot.setRangeGridlinePaint(c);
        plot.setDomainGridlinePaint(c);

        Stroke s = SwingHelper.getStroke(stroke);

        plot.setRangeGridlineStroke(s);
        plot.setDomainGridlineStroke(s);
    } else {
        plot.setRangeGridlinesVisible(false);
        plot.setDomainGridlinesVisible(false);
    }

    if (pi != null) {
        Color c = pi.getBorderColor();

        if (c != null) {
            plot.setOutlinePaint(c);
        }
    }

    int angle = cd.getDomainAxis().getAngle();

    if ((angle != 0) && (angle != 180)) {
        plot.getDomainAxis().setLabelAngle(((angle) / 180f) * Math.PI);
    } else {
        plot.getDomainAxis().setLabelAngle(0);
    }

    angle = cd.getRangeAxis().getAngle();

    if ((angle > 0) && (angle != 180)) {
        plot.getRangeAxis().setLabelAngle(((angle) / 180f) * Math.PI);
    } else {
        plot.getRangeAxis().setLabelAngle(0);
    }

    updateMarkers(cd, plot, true);
    updateMarkers(cd, plot, false);
    customizeXYLineAndShapeRenderer(cd, plot, pi);
    customizeSeriesAttributes(chartPanel, cd, plot, plot.getDatasetCount() > 1);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
}