Example usage for org.jfree.chart StandardChartTheme createLegacyTheme

List of usage examples for org.jfree.chart StandardChartTheme createLegacyTheme

Introduction

In this page you can find the example usage for org.jfree.chart StandardChartTheme createLegacyTheme.

Prototype

public static ChartTheme createLegacyTheme() 

Source Link

Document

Creates and returns a ChartTheme that doesn't apply any changes to the JFreeChart defaults.

Usage

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

protected JFreeChart createScatterChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createScatterPlot(
            (String) evaluateExpression(getChart().getTitleExpression()),
            (String) evaluateExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()),
            (String) evaluateExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()),
            (XYDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());
    XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot())
            .getRenderer();//from   www.j  a va  2 s  .c o  m

    JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
    boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines().booleanValue();
    boolean isShowShapes = scatterPlot.getShowShapes() == null ? true
            : scatterPlot.getShowShapes().booleanValue();

    plotRenderer.setBaseLinesVisible(isShowLines);
    plotRenderer.setBaseShapesVisible(isShowShapes);

    // Handle the axis formating for the category axis
    configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(),
            scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(),
            scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(),
            scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(), false,
            (Comparable) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()),
            (Comparable) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(),
            scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(),
            scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(),
            scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(), true,
            (Comparable) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()),
            (Comparable) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

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

/**
 *
 *///from  w  w w.ja v  a2  s.  co  m
protected JFreeChart createPieChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createPieChart(evaluateTextExpression(getChart().getTitleExpression()),
            (PieDataset) getDataset(), isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());
    PiePlot piePlot = (PiePlot) jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPiePlot jrPiePlot = (JRPiePlot) getPlot();
    boolean isCircular = jrPiePlot.getCircular() == null ? true : jrPiePlot.getCircular();
    piePlot.setCircular(isCircular);

    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels();

    if (isShowLabels) {
        PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator) getLabelGenerator();
        JRItemLabel itemLabel = jrPiePlot.getItemLabel();

        if (labelGenerator != null) {
            piePlot.setLabelGenerator(labelGenerator);
        } else if (jrPiePlot.getLabelFormat() != null) {
            piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator(jrPiePlot.getLabelFormat(),
                    NumberFormat.getNumberInstance(getLocale()), NumberFormat.getPercentInstance(getLocale())));
        }
        //      else if (itemLabel != null && itemLabel.getMask() != null)
        //      {
        //         piePlot.setLabelGenerator(
        //               new StandardPieSectionLabelGenerator(itemLabel.getMask())
        //               );
        //
        //      }

        Integer baseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
                ChartThemesConstants.BASEFONT_SIZE);
        JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont() : null;

        piePlot.setLabelFont(getFont(new JRBaseFont(getChart(), null), font, baseFontSize));

        if (itemLabel != null && itemLabel.getColor() != null) {
            piePlot.setLabelPaint(itemLabel.getColor());
        } else {
            piePlot.setLabelPaint(getChart().getForecolor());
        }

        if (itemLabel != null && itemLabel.getBackgroundColor() != null) {
            piePlot.setLabelBackgroundPaint(itemLabel.getBackgroundColor());
        } else {
            piePlot.setLabelBackgroundPaint(getChart().getBackcolor());
        }
    } else {
        piePlot.setLabelGenerator(null);
    }

    if (jrPiePlot.getLegendLabelFormat() != null) {
        piePlot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(jrPiePlot.getLegendLabelFormat(),
                NumberFormat.getNumberInstance(getLocale()), NumberFormat.getPercentInstance(getLocale())));
    }

    return jfreeChart;
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

protected JFreeChart createScatterChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createScatterPlot(
            (String) evaluateExpression(getChart().getTitleExpression()),
            (String) evaluateExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()),
            (String) evaluateExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()),
            (XYDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());
    XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot())
            .getRenderer();//w  w  w.ja  v  a2  s . com

    JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
    boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines().booleanValue();
    boolean isShowShapes = scatterPlot.getShowShapes() == null ? true
            : scatterPlot.getShowShapes().booleanValue();

    plotRenderer.setBaseLinesVisible(isShowLines);
    plotRenderer.setBaseShapesVisible(isShowShapes);

    // Handle the axis formating for the category axis
    configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(),
            scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(),
            scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(),
            scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()),
            (Comparable) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(),
            scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(),
            scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(),
            scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(),
            getRangeAxisSettings(),
            (Comparable) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()),
            (Comparable) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

/**
 *
 *//*from w  ww .  j  av  a 2  s .  c o m*/
protected JFreeChart createPieChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createPieChart(evaluateTextExpression(getChart().getTitleExpression()),
            (PieDataset) getDataset(), isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());
    PiePlot piePlot = (PiePlot) jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPiePlot jrPiePlot = (JRPiePlot) getPlot();
    boolean isCircular = jrPiePlot.getCircular() == null ? true : jrPiePlot.getCircular();
    piePlot.setCircular(isCircular);

    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels();

    if (isShowLabels) {
        PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator) getLabelGenerator();
        JRItemLabel itemLabel = jrPiePlot.getItemLabel();
        if (labelGenerator != null) {
            piePlot.setLabelGenerator(labelGenerator);
        } else if (jrPiePlot.getLabelFormat() != null) {
            piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator(jrPiePlot.getLabelFormat(),
                    NumberFormat.getNumberInstance(getLocale()), NumberFormat.getPercentInstance(getLocale())));
        }
        //      else if (itemLabel != null && itemLabel.getMask() != null)
        //      {
        //         piePlot.setLabelGenerator(
        //               new StandardPieSectionLabelGenerator(itemLabel.getMask())
        //               );
        //      }

        if (itemLabel != null && itemLabel.getFont() != null) {
            piePlot.setLabelFont(getFontUtil().getAwtFont(itemLabel.getFont(), getLocale()));
        } else {
            piePlot.setLabelFont(getFontUtil().getAwtFont(new JRBaseFont(getChart(), null), getLocale()));
        }

        if (itemLabel != null && itemLabel.getColor() != null) {
            piePlot.setLabelPaint(itemLabel.getColor());
        } else {
            piePlot.setLabelPaint(getChart().getForecolor());
        }

        if (itemLabel != null && itemLabel.getBackgroundColor() != null) {
            piePlot.setLabelBackgroundPaint(itemLabel.getBackgroundColor());
        } else {
            piePlot.setLabelBackgroundPaint(getChart().getBackcolor());
        }
    } else {
        piePlot.setLabelGenerator(null);
    }

    if (jrPiePlot.getLegendLabelFormat() != null) {
        piePlot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(
                ((JRPiePlot) getPlot()).getLegendLabelFormat(), NumberFormat.getNumberInstance(getLocale()),
                NumberFormat.getPercentInstance(getLocale())));
    }

    return jfreeChart;
}

From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java

/**
 *
 *//*from w w  w . j a va 2  s  .c om*/
protected JFreeChart createPie3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createPieChart3D(
            evaluateTextExpression(getChart().getTitleExpression()), (PieDataset) getDataset(), isShowLegend(),
            true, false);

    configureChart(jfreeChart);

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPie3DPlot jrPie3DPlot = (JRPie3DPlot) getPlot();
    double depthFactor = jrPie3DPlot.getDepthFactorDouble() == null ? JRPie3DPlot.DEPTH_FACTOR_DEFAULT
            : jrPie3DPlot.getDepthFactorDouble();
    boolean isCircular = jrPie3DPlot.getCircular() == null ? false : jrPie3DPlot.getCircular();
    piePlot3D.setDepthFactor(depthFactor);
    piePlot3D.setCircular(isCircular);

    boolean isShowLabels = jrPie3DPlot.getShowLabels() == null ? true : jrPie3DPlot.getShowLabels();

    if (isShowLabels) {
        PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator) getLabelGenerator();
        JRItemLabel itemLabel = jrPie3DPlot.getItemLabel();
        if (labelGenerator != null) {
            piePlot3D.setLabelGenerator(labelGenerator);
        } else if (jrPie3DPlot.getLabelFormat() != null) {
            piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator(jrPie3DPlot.getLabelFormat(),
                    NumberFormat.getNumberInstance(getLocale()), NumberFormat.getPercentInstance(getLocale())));
        } // the default section label is just the key, so there's no need to set localized number formats
        //      else if (itemLabel != null && itemLabel.getMask() != null)
        //      {
        //         piePlot3D.setLabelGenerator(
        //               new StandardPieSectionLabelGenerator(itemLabel.getMask())
        //               );
        //      }

        piePlot3D.setLabelFont(
                fontUtil.getAwtFont(getFont(itemLabel == null ? null : itemLabel.getFont()), getLocale()));

        if (itemLabel != null && itemLabel.getColor() != null) {
            piePlot3D.setLabelPaint(itemLabel.getColor());
        } else {
            piePlot3D.setLabelPaint(getChart().getForecolor());
        }

        if (itemLabel != null && itemLabel.getBackgroundColor() != null) {
            piePlot3D.setLabelBackgroundPaint(itemLabel.getBackgroundColor());
        } else {
            piePlot3D.setLabelBackgroundPaint(getChart().getBackcolor());
        }
    } else {
        piePlot3D.setLabelGenerator(null);
    }

    if (jrPie3DPlot.getLegendLabelFormat() != null) {
        piePlot3D.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(
                jrPie3DPlot.getLegendLabelFormat(), NumberFormat.getNumberInstance(getLocale()),
                NumberFormat.getPercentInstance(getLocale())));
    } // the default legend label is just the key, so there's no need to set localized number formats

    return jfreeChart;
}

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

/**
 *
 *///from   w ww .  j a v  a 2  s .  c o m
protected JFreeChart createStackedBar3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createStackedBarChart3D(
            (String) evaluateExpression(getChart().getTitleExpression()),
            (String) evaluateExpression(((JRBar3DPlot) getPlot()).getCategoryAxisLabelExpression()),
            (String) evaluateExpression(((JRBar3DPlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    JRBar3DPlot bar3DPlot = (JRBar3DPlot) getPlot();

    StackedBarRenderer3D stackedBarRenderer3D = new StackedBarRenderer3D(
            bar3DPlot.getXOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_X_OFFSET
                    : bar3DPlot.getXOffsetDouble().doubleValue(),
            bar3DPlot.getYOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_Y_OFFSET
                    : bar3DPlot.getYOffsetDouble().doubleValue());

    stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
    stackedBarRenderer3D.setBaseItemLabelsVisible(bar3DPlot.getShowLabels());

    categoryPlot.setRenderer(stackedBarRenderer3D);

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
            bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
            bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(),
            bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getOwnCategoryAxisLineColor(), false,
            (Comparable) evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()),
            (Comparable) evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
            bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
            bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(),
            bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getOwnValueAxisLineColor(), true,
            (Comparable) evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()),
            (Comparable) evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

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

protected JFreeChart createScatterChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createScatterPlot(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()),
            evaluateTextExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()),
            (XYDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true,
            false);// ww  w.j  a v  a2  s .  c om

    configureChart(jfreeChart, getPlot());
    XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot())
            .getRenderer();

    JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
    boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines();
    boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes();

    plotRenderer.setBaseLinesVisible(isShowLines);
    plotRenderer.setBaseShapesVisible(isShowShapes);

    // Handle the axis formating for the category axis
    configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(),
            scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(),
            scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(),
            scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(), false,
            (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(),
            scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(),
            scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(),
            scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:ubic.gemma.web.controller.expression.experiment.ExpressionExperimentQCController.java

/**
 * Visualization of the correlation of principal components with factors or the date samples were run.
 *
 * @param svdo SVD value object//  ww  w  . ja v a  2 s  .  c om
 */
private void writePCAFactors(OutputStream os, ExpressionExperiment ee, SVDValueObject svdo) throws Exception {
    Map<Integer, Map<Long, Double>> factorCorrelations = svdo.getFactorCorrelations();
    // Map<Integer, Map<Long, Double>> factorPvalues = svdo.getFactorPvalues();
    Map<Integer, Double> dateCorrelations = svdo.getDateCorrelations();

    assert ee.getId().equals(svdo.getId());

    if (factorCorrelations.isEmpty() && dateCorrelations.isEmpty()) {
        this.writePlaceholderImage(os);
        return;
    }
    ee = expressionExperimentService.thawLite(ee); // need the experimental design
    int maxWidth = 10;

    Map<Long, String> efs = this.getFactorNames(ee, maxWidth);

    DefaultCategoryDataset series = new DefaultCategoryDataset();

    /*
     * With two groups, or a continuous factor, we get rank correlations
     */
    int MAX_COMP = 3;
    double STUB = 0.05; // always plot a little thing so we know its there.
    for (Integer component : factorCorrelations.keySet()) {
        if (component >= MAX_COMP)
            break;
        for (Long efId : factorCorrelations.get(component).keySet()) {
            Double a = factorCorrelations.get(component).get(efId);
            String facname = efs.get(efId) == null ? "?" : efs.get(efId);
            if (a != null && !Double.isNaN(a)) {
                Double corr = Math.max(STUB, Math.abs(a));
                series.addValue(corr, "PC" + (component + 1), facname);
            }
        }
    }

    for (Integer component : dateCorrelations.keySet()) {
        if (component >= MAX_COMP)
            break;
        Double a = dateCorrelations.get(component);
        if (a != null && !Double.isNaN(a)) {
            Double corr = Math.max(STUB, Math.abs(a));
            series.addValue(corr, "PC" + (component + 1), "Date run");
        }
    }
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart chart = ChartFactory.createBarChart("", "Factors", "Component assoc.", series,
            PlotOrientation.VERTICAL, true, false, false);

    chart.getCategoryPlot().getRangeAxis().setRange(0, 1);
    BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
    renderer.setBasePaint(Color.white);
    renderer.setShadowVisible(false);
    chart.getCategoryPlot().setRangeGridlinesVisible(false);
    chart.getCategoryPlot().setDomainGridlinesVisible(false);
    ChartUtilities.applyCurrentTheme(chart);

    CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    for (int i = 0; i < MAX_COMP; i++) {
        /*
         * Hue is straightforward; brightness is set medium to make it muted; saturation we vary from high to low.
         */
        float saturationDrop = (float) Math.min(1.0, i * 1.3f / MAX_COMP);
        renderer.setSeriesPaint(i, Color.getHSBColor(0.0f, 1.0f - saturationDrop, 0.7f));

    }

    /*
     * Give figure more room .. up to a limit
     */
    int width = ExpressionExperimentQCController.DEFAULT_QC_IMAGE_SIZE_PX;
    if (chart.getCategoryPlot().getCategories().size() > 3) {
        width = width + 40 * (chart.getCategoryPlot().getCategories().size() - 2);
    }
    int MAX_QC_IMAGE_SIZE_PX = 500;
    width = Math.min(width, MAX_QC_IMAGE_SIZE_PX);
    ChartUtilities.writeChartAsPNG(os, chart, width, ExpressionExperimentQCController.DEFAULT_QC_IMAGE_SIZE_PX);
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

/**
 *
 *///from  ww w .  j av  a2s.c  o  m
protected JFreeChart createStackedBar3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createStackedBarChart3D(
            (String) evaluateExpression(getChart().getTitleExpression()),
            (String) evaluateExpression(((JRBar3DPlot) getPlot()).getCategoryAxisLabelExpression()),
            (String) evaluateExpression(((JRBar3DPlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    JRBar3DPlot bar3DPlot = (JRBar3DPlot) getPlot();

    StackedBarRenderer3D stackedBarRenderer3D = new StackedBarRenderer3D(
            bar3DPlot.getXOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_X_OFFSET
                    : bar3DPlot.getXOffsetDouble().doubleValue(),
            bar3DPlot.getYOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_Y_OFFSET
                    : bar3DPlot.getYOffsetDouble().doubleValue());

    stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
    stackedBarRenderer3D.setBaseItemLabelsVisible(bar3DPlot.getShowLabels());

    categoryPlot.setRenderer(stackedBarRenderer3D);

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
            bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
            bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(),
            bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getOwnCategoryAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable) evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()),
            (Comparable) evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
            bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
            bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(),
            bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(), (Comparable) evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()),
            (Comparable) evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

protected JFreeChart createScatterChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createScatterPlot(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRScatterPlot) getPlot()).getXAxisLabelExpression()),
            evaluateTextExpression(((JRScatterPlot) getPlot()).getYAxisLabelExpression()),
            (XYDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true,
            false);/* w ww.j a  v  a  2  s .c  o m*/

    configureChart(jfreeChart, getPlot());
    XYLineAndShapeRenderer plotRenderer = (XYLineAndShapeRenderer) ((XYPlot) jfreeChart.getPlot())
            .getRenderer();

    JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
    boolean isShowLines = scatterPlot.getShowLines() == null ? true : scatterPlot.getShowLines();
    boolean isShowShapes = scatterPlot.getShowShapes() == null ? true : scatterPlot.getShowShapes();

    plotRenderer.setBaseLinesVisible(isShowLines);
    plotRenderer.setBaseShapesVisible(isShowShapes);

    // Handle the axis formating for the category axis
    configureAxis(jfreeChart.getXYPlot().getDomainAxis(), scatterPlot.getXAxisLabelFont(),
            scatterPlot.getXAxisLabelColor(), scatterPlot.getXAxisTickLabelFont(),
            scatterPlot.getXAxisTickLabelColor(), scatterPlot.getXAxisTickLabelMask(),
            scatterPlot.getXAxisVerticalTickLabels(), scatterPlot.getOwnXAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(scatterPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(jfreeChart.getXYPlot().getRangeAxis(), scatterPlot.getYAxisLabelFont(),
            scatterPlot.getYAxisLabelColor(), scatterPlot.getYAxisTickLabelFont(),
            scatterPlot.getYAxisTickLabelColor(), scatterPlot.getYAxisTickLabelMask(),
            scatterPlot.getYAxisVerticalTickLabels(), scatterPlot.getOwnYAxisLineColor(),
            getRangeAxisSettings(),
            (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(scatterPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}