List of usage examples for org.jfree.chart ChartFactory setChartTheme
public static void setChartTheme(ChartTheme theme)
From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java
/** * *///www.j a v a2 s . co 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);//from www.j a va2 s . co 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(), 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/*from w w w. j a va2 s .co m*/ */ 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
/** * */// w ww. j ava 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(), 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 w w. j a v a 2s.co 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; }
From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java
/** * *///w w w .j a va 2 s . c o m protected JFreeChart createStackedBarChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedBarChart( (String) evaluateExpression(getChart().getTitleExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getCategoryAxisLabelExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getValueAxisLabelExpression()), (CategoryDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot(); JRBarPlot barPlot = (JRBarPlot) getPlot(); //plot.setNoDataMessage("No data to display"); boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks().booleanValue(); boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().booleanValue(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue(); categoryPlot.getDomainAxis().setTickMarksVisible(isShowTickMarks); categoryPlot.getDomainAxis().setTickLabelsVisible(isShowTickLabels); ((NumberAxis) categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks); ((NumberAxis) categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels); BarRenderer categoryRenderer = (BarRenderer) categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator()); categoryRenderer.setBaseItemLabelsVisible(isShowLabels); categoryRenderer.setShadowVisible(false); // Handle the axis formating for the category axis configureAxis(categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(), barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(), barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(), barPlot.getOwnCategoryAxisLineColor(), false, (Comparable) evaluateExpression(barPlot.getDomainAxisMinValueExpression()), (Comparable) evaluateExpression(barPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(), barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(), barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(), barPlot.getOwnValueAxisLineColor(), true, (Comparable) evaluateExpression(barPlot.getRangeAxisMinValueExpression()), (Comparable) evaluateExpression(barPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
/** * *///from ww w.ja va2s . com protected JFreeChart createPieChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createPieChart(evaluateTextExpression(getChart().getTitleExpression()), (PieDataset) getDataset(), isShowLegend(), true, false); configureChart(jfreeChart); 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()))); } // 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) // { // piePlot.setLabelGenerator( // new StandardPieSectionLabelGenerator(itemLabel.getMask()) // ); // } piePlot.setLabelFont( fontUtil.getAwtFont(getFont(itemLabel == null ? null : itemLabel.getFont()), 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.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.jasperreports.chartthemes.spring.GenericChartTheme.java
/** * *///from ww w . j a v a2 s. c om protected JFreeChart createStackedBar3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedBarChart3D( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBar3DPlot) getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBar3DPlot) getPlot()).getValueAxisLabelExpression()), (CategoryDataset) getDataset(), getPlot().getOrientationValue().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(), bar3DPlot.getYOffsetDouble() == null ? StackedBarRenderer3D.DEFAULT_Y_OFFSET : bar3DPlot.getYOffsetDouble()); boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels(); stackedBarRenderer3D.setBaseItemLabelsVisible(isShowLabels); if (isShowLabels) { JRItemLabel itemLabel = bar3DPlot.getItemLabel(); stackedBarRenderer3D.setBaseItemLabelFont( getFontUtil().getAwtFont(getFont(itemLabel == null ? null : itemLabel.getFont()), getLocale())); if (itemLabel != null) { if (itemLabel.getColor() != null) { stackedBarRenderer3D.setBaseItemLabelPaint(itemLabel.getColor()); } else { stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } // categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor()); // if(itemLabel.getMask() != null) // { // barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator( // StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, // new DecimalFormat(itemLabel.getMask()))); // } // else // { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator()); // } } else { stackedBarRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator()); stackedBarRenderer3D.setBaseItemLabelPaint(getChart().getForecolor()); } } 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:ubic.gemma.web.controller.expression.experiment.ExpressionExperimentQCController.java
private boolean writePCAScree(OutputStream os, SVDValueObject svdo) throws Exception { /*/* w w w.jav a 2 s . c o m*/ * Make a scree plot. */ CategoryDataset series = this.getPCAScree(svdo); if (series.getColumnCount() == 0) { return false; } int MAX_COMPONENTS_FOR_SCREE = 10; ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart chart = ChartFactory.createBarChart("", "Component (up to" + MAX_COMPONENTS_FOR_SCREE + ")", "Fraction of var.", series, PlotOrientation.VERTICAL, false, false, false); BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); renderer.setBasePaint(Color.white); renderer.setShadowVisible(false); chart.getCategoryPlot().setRangeGridlinesVisible(false); chart.getCategoryPlot().setDomainGridlinesVisible(false); ChartUtilities.writeChartAsPNG(os, chart, ExpressionExperimentQCController.DEFAULT_QC_IMAGE_SIZE_PX, ExpressionExperimentQCController.DEFAULT_QC_IMAGE_SIZE_PX); return true; }
From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java
/** * *//*from w w w . j a v a2 s .c om*/ protected JFreeChart createStackedBarChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedBarChart( (String) evaluateExpression(getChart().getTitleExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getCategoryAxisLabelExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getValueAxisLabelExpression()), (CategoryDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot(); JRBarPlot barPlot = (JRBarPlot) getPlot(); //plot.setNoDataMessage("No data to display"); boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks().booleanValue(); boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels().booleanValue(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels().booleanValue(); categoryPlot.getDomainAxis().setTickMarksVisible(isShowTickMarks); categoryPlot.getDomainAxis().setTickLabelsVisible(isShowTickLabels); ((NumberAxis) categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks); ((NumberAxis) categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels); BarRenderer categoryRenderer = (BarRenderer) categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator()); categoryRenderer.setBaseItemLabelsVisible(isShowLabels); categoryRenderer.setShadowVisible(false); // Handle the axis formating for the category axis configureAxis(categoryPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(), barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(), barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(), barPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable) evaluateExpression(barPlot.getDomainAxisMinValueExpression()), (Comparable) evaluateExpression(barPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(categoryPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(), barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(), barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(), barPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable) evaluateExpression(barPlot.getRangeAxisMinValueExpression()), (Comparable) evaluateExpression(barPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }