Example usage for org.jfree.chart.plot CategoryPlot setOutlineStroke

List of usage examples for org.jfree.chart.plot CategoryPlot setOutlineStroke

Introduction

In this page you can find the example usage for org.jfree.chart.plot CategoryPlot setOutlineStroke.

Prototype

public void setOutlineStroke(Stroke stroke) 

Source Link

Document

Sets the stroke used to outline the plot area and sends a PlotChangeEvent to all registered listeners.

Usage

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

/**
 *
 *//*  w  w  w .  ja v  a  2  s  . c  om*/
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
    categoryPlot.getDomainAxis().setTickLabelsVisible(
            //barPlot.isShowTickLabels()
            true);
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    barRenderer.setSeriesPaint(0, (Paint) ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3));
    barRenderer.setSeriesPaint(1, (Paint) ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
        }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

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

@Override
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_134);
    categoryPlot.getDomainAxis().setTickLabelsVisible(
            //barPlot.isShowTickLabels()
            true);/*from w w w .j ava2  s  .c o m*/
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    barRenderer.setSeriesPaint(0, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(3));
    barRenderer.setSeriesPaint(1, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
        }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

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

/**
 *
 *///w  w  w  . j av a 2s . c  o m
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
    //      JRBarPlot barPlot = (BarPlot)categoryPlot;
    //      categoryPlot.getDomainAxis().setTickLabelsVisible(
    //            categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().
    //            true
    //            );
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    List seriesPaints = (List) getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.SERIES_COLORS);
    barRenderer.setSeriesPaint(0, (Paint) seriesPaints.get(3));
    barRenderer.setSeriesPaint(1, (Paint) seriesPaints.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
            //         barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]);
            //         CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f));
            //         categoryMarker.setAlpha(0.5f);
            //         categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND);
        }
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

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

@Override
protected JFreeChart createGanttChart() throws JRException {

    JFreeChart jfreeChart = super.createGanttChart();
    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    categoryPlot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    categoryPlot.setDomainGridlinesVisible(true);
    categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);
    categoryPlot.setDomainGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setDomainGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);

    categoryPlot.setRangeGridlinesVisible(true);
    categoryPlot.setRangeGridlineStroke(
            new BasicStroke(0.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 50, new float[] { 1 }, 0));

    categoryPlot.setRangeGridlinePaint(ChartThemesConstants.GRAY_PAINT_217);
    //      JRBarPlot barPlot = (BarPlot)categoryPlot;
    //      categoryPlot.getDomainAxis().setTickLabelsVisible(
    //            categoryPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().
    //            true
    //            );
    CategoryItemRenderer categoryRenderer = categoryPlot.getRenderer();
    categoryRenderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) categoryRenderer;
    @SuppressWarnings("unchecked")
    List<Paint> seriesPaints = (List<Paint>) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.SERIES_COLORS);
    barRenderer.setSeriesPaint(0, seriesPaints.get(3));
    barRenderer.setSeriesPaint(1, seriesPaints.get(0));
    CategoryDataset categoryDataset = categoryPlot.getDataset();
    if (categoryDataset != null) {
        for (int i = 0; i < categoryDataset.getRowCount(); i++) {
            barRenderer.setSeriesItemLabelFont(i, categoryPlot.getDomainAxis().getTickLabelFont());
            barRenderer.setSeriesItemLabelsVisible(i, true);
            //         barRenderer.setSeriesPaint(i, GRADIENT_PAINTS[i]);
            //         CategoryMarker categoryMarker = new CategoryMarker(categoryDataset.getColumnKey(i),MARKER_COLOR, new BasicStroke(1f));
            //         categoryMarker.setAlpha(0.5f);
            //         categoryPlot.addDomainMarker(categoryMarker, Layer.BACKGROUND);
        }/*from   w  w  w .  j  a  v a  2  s .  c om*/
    }
    categoryPlot.setOutlinePaint(Color.DARK_GRAY);
    categoryPlot.setOutlineStroke(new BasicStroke(1.5f));
    categoryPlot.setOutlineVisible(true);
    return jfreeChart;
}

From source file:jhplot.HChart.java

/**
 * Update the chart/*from   w  w  w.java2 s .  com*/
 * 
 * @param N1
 *            location in X
 * @param N2
 *            location in Y
 */
public void update(int N1, int N2) {

    if (cdatPie[N1][N2] != null || cdatPie3D[N1][N2] != null || cdatBar[N1][N2] != null
            || cdatBar3D[N1][N2] != null || cdatLine[N1][N2] != null || cdatArea[N1][N2] != null
            || cdatPolar[N1][N2] != null) {

        if (cdatPie[N1][N2] != null) {
            chart[N1][N2] = ChartFactory.createPieChart(title[N1][N2], (PieDataset) cdatPie[N1][N2], true, true,
                    true);

        } else if (cdatPie3D[N1][N2] != null) {
            chart[N1][N2] = ChartFactory.createPieChart3D(title[N1][N2], (PieDataset) cdatPie3D[N1][N2], true,
                    true, true);
            PiePlot3D pieplot3d = (PiePlot3D) chart[N1][N2].getPlot();
            // pieplot3d.setStartAngle(290D);
            // pieplot3d.setDirection(Rotation.CLOCKWISE);
            // pieplot3d.setForegroundAlpha(0.5F);
            pieplot3d.setBackgroundPaint(DEFAULT_BG_COLOR);

        } else if (cdatBar[N1][N2] != null) {
            chart[N1][N2] = ChartFactory.createBarChart(title[N1][N2], titleX[N1][N2], titleY[N1][N2],
                    (CategoryDataset) cdatBar[N1][N2], PlotOrientation.VERTICAL, true, true, true);
            CategoryPlot lineplot = (CategoryPlot) chart[N1][N2].getPlot();

            CategoryAxis yy = lineplot.getDomainAxis();
            yy.setTickLabelPaint(tickColor);
            yy.setTickLabelFont(tickFont);
            yy.setLabelPaint(labelColor);
            yy.setLabelFont(labelFont);
            yy.setAxisLineStroke(new BasicStroke(axisPenwidth));
            yy.setAxisLinePaint(Color.black);
            ValueAxis xx = lineplot.getRangeAxis();
            xx.setTickLabelPaint(tickColor);
            xx.setTickLabelFont(tickFont);
            xx.setLabelPaint(labelColor);
            xx.setLabelFont(labelFont);
            xx.setAxisLineStroke(new BasicStroke(axisPenwidth));
            xx.setAxisLinePaint(Color.black);

        } else if (cdatBar3D[N1][N2] != null) {
            chart[N1][N2] = ChartFactory.createBarChart3D(title[N1][N2], titleX[N1][N2], titleY[N1][N2],
                    (CategoryDataset) cdatBar3D[N1][N2], PlotOrientation.VERTICAL, true, true, true);
        } else if (cdatLine[N1][N2] != null) {
            chart[N1][N2] = ChartFactory.createLineChart(title[N1][N2], titleX[N1][N2], titleY[N1][N2],
                    (CategoryDataset) cdatLine[N1][N2], PlotOrientation.VERTICAL, true, true, true);
            CategoryPlot lineplot = (CategoryPlot) chart[N1][N2].getPlot();
            lineplot.setOutlineStroke(new BasicStroke(axisPenwidth));
            CategoryAxis yy = lineplot.getDomainAxis();
            yy.setTickLabelPaint(tickColor);
            yy.setTickLabelFont(tickFont);
            yy.setLabelPaint(labelColor);
            yy.setLabelFont(labelFont);
            yy.setAxisLineStroke(new BasicStroke(axisPenwidth));
            yy.setAxisLinePaint(Color.black);
            ValueAxis xx = lineplot.getRangeAxis();
            xx.setTickLabelPaint(tickColor);
            xx.setTickLabelFont(tickFont);
            xx.setLabelPaint(labelColor);
            xx.setLabelFont(labelFont);
            xx.setAxisLineStroke(new BasicStroke(axisPenwidth));
            xx.setAxisLinePaint(Color.black);

            LineAndShapeRenderer renderer = (LineAndShapeRenderer) lineplot.getRenderer();
            renderer.setBaseStroke(new BasicStroke(linestroke));
            for (int m = 0; m < cdatLine[N1][N2].getColumnCount() + 1; m++)
                renderer.setSeriesStroke(m, new BasicStroke(linestroke));

        } else if (cdatPolar[N1][N2] != null) {
            chart[N1][N2] = ChartFactory.createPolarChart(title[N1][N2], (XYSeriesCollection) cdatPolar[N1][N2],
                    true, true, true);
            PolarPlot lineplot = (PolarPlot) chart[N1][N2].getPlot();
            ValueAxis yy = lineplot.getAxis();
            yy.setTickLabelPaint(tickColor);
            yy.setTickLabelFont(tickFont);
            yy.setLabelPaint(labelColor);
            yy.setLabelFont(labelFont);
            yy.setAxisLineStroke(new BasicStroke(axisPenwidth));
            yy.setAxisLinePaint(Color.black);

        } else if (cdatArea[N1][N2] != null) {

            chart[N1][N2] = ChartFactory.createAreaChart(title[N1][N2], titleX[N1][N2], titleY[N1][N2],
                    (CategoryDataset) cdatArea[N1][N2], PlotOrientation.VERTICAL, true, true, true);
            CategoryPlot lineplot = (CategoryPlot) chart[N1][N2].getPlot();

            CategoryAxis yy = lineplot.getDomainAxis();
            yy.setTickLabelPaint(tickColor);
            yy.setTickLabelFont(tickFont);
            yy.setLabelPaint(labelColor);
            yy.setLabelFont(labelFont);
            yy.setAxisLineStroke(new BasicStroke(axisPenwidth));
            yy.setAxisLinePaint(Color.black);
            ValueAxis xx = lineplot.getRangeAxis();
            xx.setTickLabelPaint(tickColor);
            xx.setTickLabelFont(tickFont);
            xx.setLabelPaint(labelColor);
            xx.setLabelFont(labelFont);
            xx.setAxisLineStroke(new BasicStroke(axisPenwidth));
            xx.setAxisLinePaint(Color.black);

        }

        chart[N1][N2].setAntiAlias(antiAlias);
        chart[N1][N2].setBorderPaint(DEFAULT_BG_COLOR);
        chart[N1][N2].setBackgroundPaint(DEFAULT_BG_COLOR);
        chart[N1][N2].setBorderVisible(false);
        cp[N1][N2].setChart(chart[N1][N2]);
        return;
    }

    for (int i = 0; i < indexdat[N1][N2]; i++) {

        if (type[N1][N2].get(i) == "array")
            xyplot[N1][N2].setRenderer(i, (StandardXYItemRenderer) (rdat[N1][N2].get(i)));
        else if (type[N1][N2].get(i) == "f")
            xyplot[N1][N2].setRenderer(i, (XYLineAndShapeRenderer) (rdat[N1][N2].get(i)));
        else if (type[N1][N2].get(i) == "h")
            xyplot[N1][N2].setRenderer(i, (XYBarRenderer) (rdat[N1][N2].get(i)));
        else if (type[N1][N2].get(i) == "p")
            xyplot[N1][N2].setRenderer(i, (XYLineAndShapeRenderer) (rdat[N1][N2].get(i)));
        else if (type[N1][N2].get(i) == "pe")
            xyplot[N1][N2].setRenderer(i, (XYErrorRenderer) (rdat[N1][N2].get(i)));

        // System.out.println(i);

    }

    chart[N1][N2] = new JFreeChart(title[N1][N2], JFreeChart.DEFAULT_TITLE_FONT, xyplot[N1][N2], true);
    chart[N1][N2].setAntiAlias(antiAlias);
    chart[N1][N2].setBorderPaint(DEFAULT_BG_COLOR);
    chart[N1][N2].setBackgroundPaint(DEFAULT_BG_COLOR);
    chart[N1][N2].setBorderVisible(false);

    cp[N1][N2].setChart(chart[N1][N2]);

}