org.jfree.chart.StandardChartTheme Java Examples
The following examples show how to use
org.jfree.chart.StandardChartTheme.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LegacyChartModule.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Initializes the module. Use this method to perform all initial setup operations. This method is called only once in * a modules lifetime. If the initializing cannot be completed, throw a ModuleInitializeException to indicate the * error,. The module will not be available to the system. * * @param subSystem the subSystem. * @throws ModuleInitializeException if an error occurred while initializing the module. */ public void initialize( final SubSystem subSystem ) throws ModuleInitializeException { ElementMetaDataParser.initializeOptionalExpressionsMetaData ( "org/pentaho/plugin/jfreereport/reportcharts/meta-xy-chart-expressions.xml" ); ElementMetaDataParser.initializeOptionalExpressionsMetaData ( "org/pentaho/plugin/jfreereport/reportcharts/meta-other-chart-expressions.xml" ); ElementMetaDataParser.initializeOptionalExpressionsMetaData ( "org/pentaho/plugin/jfreereport/reportcharts/meta-categorical-chart-expressions.xml" ); ElementMetaDataParser.initializeOptionalExpressionsMetaData ( "org/pentaho/plugin/jfreereport/reportcharts/meta-collector-expressions.xml" ); // Set the ChartFactory to the Legacy Theme ChartFactory.setChartTheme( StandardChartTheme.createLegacyTheme() ); }
Example #2
Source File: ScatterPlot.java From Benchmark with GNU General Public License v2.0 | 6 votes |
public static StandardChartTheme initializeTheme() { String fontName = "Arial"; StandardChartTheme theme = (StandardChartTheme) org.jfree.chart.StandardChartTheme.createJFreeTheme(); theme.setExtraLargeFont(new Font(fontName, Font.PLAIN, 24)); // title theme.setLargeFont(new Font(fontName, Font.PLAIN, 20)); // axis-title theme.setRegularFont(new Font(fontName, Font.PLAIN, 16)); theme.setSmallFont(new Font(fontName, Font.PLAIN, 12)); theme.setRangeGridlinePaint(Color.decode("#C0C0C0")); theme.setPlotBackgroundPaint(Color.white); theme.setChartBackgroundPaint(Color.white); theme.setGridBandPaint(Color.red); theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); theme.setBarPainter(new StandardBarPainter()); theme.setAxisLabelPaint(Color.decode("#666666")); return theme; }
Example #3
Source File: AbstractAttributeStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Changes the font of {@link JFreeChart}s to Sans Serif. This method uses a * {@link StandardChartTheme} to do so, so any changes to the look of the chart must be done * after calling this method. * * @param chart * the chart to change fonts for */ protected static void setDefaultChartFonts(JFreeChart chart) { final ChartTheme chartTheme = StandardChartTheme.createJFreeTheme(); if (StandardChartTheme.class.isAssignableFrom(chartTheme.getClass())) { StandardChartTheme standardTheme = (StandardChartTheme) chartTheme; // The default font used by JFreeChart cannot render japanese etc symbols final Font oldExtraLargeFont = standardTheme.getExtraLargeFont(); final Font oldLargeFont = standardTheme.getLargeFont(); final Font oldRegularFont = standardTheme.getRegularFont(); final Font oldSmallFont = standardTheme.getSmallFont(); final Font extraLargeFont = FontTools.getFont(Font.SANS_SERIF, oldExtraLargeFont.getStyle(), oldExtraLargeFont.getSize()); final Font largeFont = FontTools.getFont(Font.SANS_SERIF, oldLargeFont.getStyle(), oldLargeFont.getSize()); final Font regularFont = FontTools.getFont(Font.SANS_SERIF, oldRegularFont.getStyle(), oldRegularFont.getSize()); final Font smallFont = FontTools.getFont(Font.SANS_SERIF, oldSmallFont.getStyle(), oldSmallFont.getSize()); standardTheme.setExtraLargeFont(extraLargeFont); standardTheme.setLargeFont(largeFont); standardTheme.setRegularFont(regularFont); standardTheme.setSmallFont(smallFont); standardTheme.apply(chart); } }
Example #4
Source File: AbstractBeltColumnStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Changes the font of {@link JFreeChart}s to Sans Serif. This method uses a * {@link StandardChartTheme} to do so, so any changes to the look of the chart must be done * after calling this method. * * @param chart * the chart to change fonts for */ static void setDefaultChartFonts(JFreeChart chart) { final ChartTheme chartTheme = StandardChartTheme.createJFreeTheme(); if (StandardChartTheme.class.isAssignableFrom(chartTheme.getClass())) { StandardChartTheme standardTheme = (StandardChartTheme) chartTheme; // The default font used by JFreeChart cannot render japanese etc symbols final Font oldExtraLargeFont = standardTheme.getExtraLargeFont(); final Font oldLargeFont = standardTheme.getLargeFont(); final Font oldRegularFont = standardTheme.getRegularFont(); final Font oldSmallFont = standardTheme.getSmallFont(); final Font extraLargeFont = FontTools.getFont(Font.SANS_SERIF, oldExtraLargeFont.getStyle(), oldExtraLargeFont.getSize()); final Font largeFont = FontTools.getFont(Font.SANS_SERIF, oldLargeFont.getStyle(), oldLargeFont.getSize()); final Font regularFont = FontTools.getFont(Font.SANS_SERIF, oldRegularFont.getStyle(), oldRegularFont.getSize()); final Font smallFont = FontTools.getFont(Font.SANS_SERIF, oldSmallFont.getStyle(), oldSmallFont.getSize()); standardTheme.setExtraLargeFont(extraLargeFont); standardTheme.setLargeFont(largeFont); standardTheme.setRegularFont(regularFont); standardTheme.setSmallFont(smallFont); standardTheme.apply(chart); } }
Example #5
Source File: GraphData.java From iBioSim with Apache License 2.0 | 6 votes |
public void applyChartTheme() { final StandardChartTheme chartTheme = (StandardChartTheme) org.jfree.chart.StandardChartTheme .createJFreeTheme(); final Font oldExtraLargeFont = chartTheme.getExtraLargeFont(); final Font oldLargeFont = chartTheme.getLargeFont(); final Font oldRegularFont = chartTheme.getRegularFont(); final Font oldSmallFont = chartTheme.getSmallFont(); final Font extraLargeFont = new Font("Sans-serif", oldExtraLargeFont.getStyle(), oldExtraLargeFont.getSize()); final Font largeFont = new Font("Sans-serif", oldLargeFont.getStyle(), oldLargeFont.getSize()); final Font regularFont = new Font("Sans-serif", oldRegularFont.getStyle(), oldRegularFont.getSize()); final Font smallFont = new Font("Sans-serif", oldSmallFont.getStyle(), oldSmallFont.getSize()); chartTheme.setExtraLargeFont(extraLargeFont); chartTheme.setLargeFont(largeFont); chartTheme.setRegularFont(regularFont); chartTheme.setSmallFont(smallFont); chartTheme.apply(chart); }
Example #6
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
/** * */ protected JFreeChart createAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createAreaChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression()) ); return jfreeChart; }
Example #7
Source File: ChartTheme.java From amodeus with GNU General Public License v2.0 | 5 votes |
public static StandardChartTheme valueOf(String string) { switch (string) { case "STANDARD": return STANDARD; case "SHADOWS": return SHADOWS; } throw new IllegalArgumentException(string); }
Example #8
Source File: ChartWriterFactory.java From entity-system-benchmarks with Apache License 2.0 | 5 votes |
private static void notSoUglyPlease(JFreeChart chart) { String fontName = "Lucida Sans"; StandardChartTheme theme = (StandardChartTheme)org.jfree.chart.StandardChartTheme.createJFreeTheme(); theme.setTitlePaint( Color.decode("#4572a7") ); theme.setExtraLargeFont(new Font(fontName, Font.BOLD, 14)); //title theme.setLargeFont(new Font(fontName, Font.BOLD, 15)); //axis-title theme.setRegularFont(new Font(fontName, Font.PLAIN, 11)); theme.setRangeGridlinePaint(Color.decode("#C0C0C0")); theme.setPlotBackgroundPaint(Color.white); theme.setChartBackgroundPaint(Color.white); theme.setGridBandPaint(Color.red); theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0)); theme.setBarPainter(new StandardBarPainter()); theme.setAxisLabelPaint(Color.decode("#666666")); theme.apply(chart); chart.getCategoryPlot().setOutlineVisible(false); chart.getCategoryPlot().getRangeAxis().setAxisLineVisible(false); chart.getCategoryPlot().getRangeAxis().setTickMarksVisible(false); chart.getCategoryPlot().setRangeGridlineStroke(new BasicStroke()); chart.getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.decode("#666666")); chart.getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.decode("#666666")); chart.setTextAntiAlias(true); chart.setAntiAlias(true); BarRenderer rend = (BarRenderer) chart.getCategoryPlot().getRenderer(); rend.setShadowVisible(true); rend.setShadowXOffset(2); rend.setShadowYOffset(0); rend.setShadowPaint(Color.decode("#C0C0C0")); rend.setMaximumBarWidth(0.1); }
Example #9
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected JFreeChart createXyAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createXYAreaChart( evaluateTextExpression(getChart().getTitleExpression() ), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (XYDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression()) ); return jfreeChart; }
Example #10
Source File: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected JFreeChart createXyAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createXYAreaChart( evaluateTextExpression(getChart().getTitleExpression() ), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (XYDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getOwnCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getOwnValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #11
Source File: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ protected JFreeChart createStackedAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedAreaChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getOwnCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getOwnValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression())); ((CategoryPlot)jfreeChart.getPlot()).getDomainAxis().setCategoryMargin(0); return jfreeChart; }
Example #12
Source File: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ protected JFreeChart createCandlestickChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createCandlestickChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRCandlestickPlot)getPlot()).getTimeAxisLabelExpression()), evaluateTextExpression(((JRCandlestickPlot)getPlot()).getValueAxisLabelExpression()), (DefaultHighLowDataset)getDataset(), isShowLegend() ); configureChart(jfreeChart, getPlot()); XYPlot xyPlot = (XYPlot) jfreeChart.getPlot(); JRCandlestickPlot candlestickPlot = (JRCandlestickPlot)getPlot(); CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer(); boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true : candlestickPlot.getShowVolume(); candlestickRenderer.setDrawVolume(isShowVolume); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(), candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(), candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(), candlestickPlot.getTimeAxisVerticalTickLabels(), candlestickPlot.getOwnTimeAxisLineColor(), false, (Comparable<?>)evaluateExpression(candlestickPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(candlestickPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), candlestickPlot.getValueAxisLabelFont(), candlestickPlot.getValueAxisLabelColor(), candlestickPlot.getValueAxisTickLabelFont(), candlestickPlot.getValueAxisTickLabelColor(), candlestickPlot.getValueAxisTickLabelMask(), candlestickPlot.getValueAxisVerticalTickLabels(), candlestickPlot.getOwnValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(candlestickPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(candlestickPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #13
Source File: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected JFreeChart createBubbleChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createBubbleChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBubblePlot)getPlot()).getXAxisLabelExpression()), evaluateTextExpression(((JRBubblePlot)getPlot()).getYAxisLabelExpression()), (XYZDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); XYPlot xyPlot = (XYPlot)jfreeChart.getPlot(); JRBubblePlot bubblePlot = (JRBubblePlot)getPlot(); int scaleType = bubblePlot.getScaleTypeValue() == null ? ScaleTypeEnum.ON_RANGE_AXIS.getValue() : bubblePlot.getScaleTypeValue().getValue(); XYBubbleRenderer bubbleRenderer = new XYBubbleRenderer( scaleType ); xyPlot.setRenderer( bubbleRenderer ); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), bubblePlot.getXAxisLabelFont(), bubblePlot.getXAxisLabelColor(), bubblePlot.getXAxisTickLabelFont(), bubblePlot.getXAxisTickLabelColor(), bubblePlot.getXAxisTickLabelMask(), bubblePlot.getXAxisVerticalTickLabels(), bubblePlot.getOwnXAxisLineColor(), false, (Comparable<?>)evaluateExpression(bubblePlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bubblePlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), bubblePlot.getYAxisLabelFont(), bubblePlot.getYAxisLabelColor(), bubblePlot.getYAxisTickLabelFont(), bubblePlot.getYAxisTickLabelColor(), bubblePlot.getYAxisTickLabelMask(), bubblePlot.getYAxisVerticalTickLabels(), bubblePlot.getOwnYAxisLineColor(), true, (Comparable<?>)evaluateExpression(bubblePlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bubblePlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #14
Source File: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ protected JFreeChart createAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createAreaChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getOwnCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getOwnValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #15
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected JFreeChart createXyAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createXYAreaChart( evaluateTextExpression(getChart().getTitleExpression() ), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression() ), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (XYDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #16
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ protected JFreeChart createCandlestickChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createCandlestickChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRCandlestickPlot)getPlot()).getTimeAxisLabelExpression()), evaluateTextExpression(((JRCandlestickPlot)getPlot()).getValueAxisLabelExpression()), (DefaultHighLowDataset)getDataset(), isShowLegend() ); configureChart(jfreeChart); XYPlot xyPlot = (XYPlot) jfreeChart.getPlot(); JRCandlestickPlot candlestickPlot = (JRCandlestickPlot)getPlot(); CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer(); boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true : candlestickPlot.getShowVolume(); candlestickRenderer.setDrawVolume(isShowVolume); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(), candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(), candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(), candlestickPlot.getTimeAxisVerticalTickLabels(), candlestickPlot.getTimeAxisLineColor(), false, (Comparable<?>)evaluateExpression(candlestickPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(candlestickPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), candlestickPlot.getValueAxisLabelFont(), candlestickPlot.getValueAxisLabelColor(), candlestickPlot.getValueAxisTickLabelFont(), candlestickPlot.getValueAxisTickLabelColor(), candlestickPlot.getValueAxisTickLabelMask(), candlestickPlot.getValueAxisVerticalTickLabels(), candlestickPlot.getValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(candlestickPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(candlestickPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #17
Source File: ChartTheme.java From amodeus with GNU General Public License v2.0 | 5 votes |
private static StandardChartTheme getChartTheme(StandardChartTheme standardChartTheme, boolean shadow) { standardChartTheme.setExtraLargeFont(new Font(Font.DIALOG, Font.BOLD, 24)); standardChartTheme.setLargeFont(new Font(Font.DIALOG, Font.PLAIN, 18)); standardChartTheme.setRegularFont(new Font(Font.DIALOG, Font.PLAIN, 14)); standardChartTheme.setSmallFont(new Font(Font.DIALOG, Font.PLAIN, 10)); standardChartTheme.setTitlePaint(Color.BLACK); standardChartTheme.setSubtitlePaint(Color.BLACK); standardChartTheme.setLegendBackgroundPaint(Color.WHITE); standardChartTheme.setLegendItemPaint(Color.BLACK); standardChartTheme.setChartBackgroundPaint(Color.WHITE); standardChartTheme.setDrawingSupplier(new DefaultDrawingSupplier()); standardChartTheme.setPlotBackgroundPaint(Color.WHITE); standardChartTheme.setPlotOutlinePaint(Color.BLACK); standardChartTheme.setLabelLinkStyle(PieLabelLinkStyle.STANDARD); standardChartTheme.setAxisOffset(new RectangleInsets(4, 4, 4, 4)); standardChartTheme.setDomainGridlinePaint(Color.LIGHT_GRAY); standardChartTheme.setRangeGridlinePaint(Color.LIGHT_GRAY); standardChartTheme.setBaselinePaint(Color.BLACK); standardChartTheme.setCrosshairPaint(Color.BLACK); standardChartTheme.setAxisLabelPaint(Color.DARK_GRAY); standardChartTheme.setTickLabelPaint(Color.DARK_GRAY); standardChartTheme.setBarPainter(new StandardBarPainter()); standardChartTheme.setXYBarPainter(new StandardXYBarPainter()); standardChartTheme.setShadowVisible(shadow); standardChartTheme.setItemLabelPaint(Color.BLACK); standardChartTheme.setThermometerPaint(Color.WHITE); standardChartTheme.setErrorIndicatorPaint(Color.RED); return standardChartTheme; }
Example #18
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ protected JFreeChart createAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createAreaChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #19
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected JFreeChart createBubbleChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createBubbleChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBubblePlot)getPlot()).getXAxisLabelExpression()), evaluateTextExpression(((JRBubblePlot)getPlot()).getYAxisLabelExpression()), (XYZDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart); XYPlot xyPlot = (XYPlot)jfreeChart.getPlot(); JRBubblePlot bubblePlot = (JRBubblePlot)getPlot(); int scaleType = bubblePlot.getScaleTypeValue() == null ? ScaleTypeEnum.ON_RANGE_AXIS.getValue() : bubblePlot.getScaleTypeValue().getValue(); XYBubbleRenderer bubbleRenderer = new XYBubbleRenderer( scaleType ); xyPlot.setRenderer( bubbleRenderer ); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), bubblePlot.getXAxisLabelFont(), bubblePlot.getXAxisLabelColor(), bubblePlot.getXAxisTickLabelFont(), bubblePlot.getXAxisTickLabelColor(), bubblePlot.getXAxisTickLabelMask(), bubblePlot.getXAxisVerticalTickLabels(), bubblePlot.getXAxisLineColor(), false, (Comparable<?>)evaluateExpression(bubblePlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bubblePlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), bubblePlot.getYAxisLabelFont(), bubblePlot.getYAxisLabelColor(), bubblePlot.getYAxisTickLabelFont(), bubblePlot.getYAxisTickLabelColor(), bubblePlot.getYAxisTickLabelMask(), bubblePlot.getYAxisVerticalTickLabels(), bubblePlot.getYAxisLineColor(), true, (Comparable<?>)evaluateExpression(bubblePlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(bubblePlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
Example #20
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ protected JFreeChart createStackedAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedAreaChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression())); ((CategoryPlot)jfreeChart.getPlot()).getDomainAxis().setCategoryMargin(0); return jfreeChart; }
Example #21
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected JFreeChart createXyLineChart() throws JRException { JRLinePlot linePlot = (JRLinePlot) getPlot(); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createXYLineChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(linePlot.getCategoryAxisLabelExpression()), evaluateTextExpression(linePlot.getValueAxisLabelExpression()), (XYDataset)getDataset(), linePlot.getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), linePlot.getCategoryAxisLabelFont(), linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(), linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(), linePlot.getCategoryAxisVerticalTickLabels(), linePlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(linePlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(linePlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), linePlot.getValueAxisLabelFont(), linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(), linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(), linePlot.getValueAxisVerticalTickLabels(), linePlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(linePlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(linePlot.getRangeAxisMaxValueExpression()) ); XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) jfreeChart.getXYPlot().getRenderer(); boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes(); boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines(); lineRenderer.setBaseShapesVisible(isShowShapes); lineRenderer.setBaseLinesVisible(isShowLines); return jfreeChart; }
Example #22
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createHighLowChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createHighLowChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression()), evaluateTextExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression()), (DefaultHighLowDataset)getDataset(), isShowLegend() ); configureChart(jfreeChart, getPlot()); XYPlot xyPlot = (XYPlot) jfreeChart.getPlot(); JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot(); HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer(); boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks(); boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks(); hlRenderer.setDrawOpenTicks(isShowOpenTicks); hlRenderer.setDrawCloseTicks(isShowCloseTicks); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(), highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(), highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(), highLowPlot.getTimeAxisVerticalTickLabels(), highLowPlot.getOwnTimeAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), highLowPlot.getValueAxisLabelFont(), highLowPlot.getValueAxisLabelColor(), highLowPlot.getValueAxisTickLabelFont(), highLowPlot.getValueAxisTickLabelColor(), highLowPlot.getValueAxisTickLabelMask(), highLowPlot.getValueAxisVerticalTickLabels(), highLowPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMaxValueExpression()) ); return jfreeChart; }
Example #23
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected JFreeChart createLineChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart freeChart = ChartFactory.createLineChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression( ((JRLinePlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRLinePlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(freeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot)freeChart.getPlot(); JRLinePlot linePlot = (JRLinePlot)getPlot(); LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer)categoryPlot.getRenderer(); boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes(); boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines(); lineRenderer.setBaseShapesVisible( isShowShapes );//FIXMECHART check this lineRenderer.setBaseLinesVisible( isShowLines ); //FIXME labels? // Handle the axis formating for the category axis configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(), linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(), linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(), linePlot.getCategoryAxisVerticalTickLabels(), linePlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(linePlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(linePlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(), linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(), linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(), linePlot.getValueAxisVerticalTickLabels(), linePlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(linePlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(linePlot.getRangeAxisMaxValueExpression()) ); return freeChart; }
Example #24
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createPie3DChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createPieChart3D( evaluateTextExpression(getChart().getTitleExpression()), (PieDataset)getDataset(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); 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())) ); } // else if (itemLabel != null && itemLabel.getMask() != null) // { // piePlot3D.setLabelGenerator( // new StandardPieSectionLabelGenerator(itemLabel.getMask()) // ); // } if (itemLabel != null && itemLabel.getFont() != null) { piePlot3D.setLabelFont(getFontUtil().getAwtFont(itemLabel.getFont(), getLocale())); } else { piePlot3D.setLabelFont(getFontUtil().getAwtFont(new JRBaseFont(getChart(), null), 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())) ); } return jfreeChart; }
Example #25
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ 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; }
Example #26
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
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); 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; }
Example #27
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ 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(), 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; }
Example #28
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createStackedAreaChart() throws JRException { ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createStackedAreaChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRAreaPlot)getPlot()).getValueAxisLabelExpression()), (CategoryDataset)getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); JRAreaPlot areaPlot = (JRAreaPlot)getPlot(); // Handle the axis formating for the category axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getDomainAxis(), areaPlot.getCategoryAxisLabelFont(), areaPlot.getCategoryAxisLabelColor(), areaPlot.getCategoryAxisTickLabelFont(), areaPlot.getCategoryAxisTickLabelColor(), areaPlot.getCategoryAxisTickLabelMask(), areaPlot.getCategoryAxisVerticalTickLabels(), areaPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(((CategoryPlot)jfreeChart.getPlot()).getRangeAxis(), areaPlot.getValueAxisLabelFont(), areaPlot.getValueAxisLabelColor(), areaPlot.getValueAxisTickLabelFont(), areaPlot.getValueAxisTickLabelColor(), areaPlot.getValueAxisTickLabelMask(), areaPlot.getValueAxisVerticalTickLabels(), areaPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(areaPlot.getRangeAxisMaxValueExpression()) ); ((CategoryPlot)jfreeChart.getPlot()).getDomainAxis().setCategoryMargin(0); return jfreeChart; }
Example #29
Source File: DefaultChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected JFreeChart createXyLineChart() throws JRException { JRLinePlot linePlot = (JRLinePlot) getPlot(); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createXYLineChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(linePlot.getCategoryAxisLabelExpression()), evaluateTextExpression(linePlot.getValueAxisLabelExpression() ), (XYDataset)getDataset(), linePlot.getOrientationValue().getOrientation(), isShowLegend(), true, false); configureChart(jfreeChart); // Handle the axis formating for the category axis configureAxis(jfreeChart.getXYPlot().getDomainAxis(), linePlot.getCategoryAxisLabelFont(), linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(), linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(), linePlot.getCategoryAxisVerticalTickLabels(), linePlot.getCategoryAxisLineColor(), false, (Comparable<?>)evaluateExpression(linePlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(linePlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(jfreeChart.getXYPlot().getRangeAxis(), linePlot.getValueAxisLabelFont(), linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(), linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(), linePlot.getValueAxisVerticalTickLabels(), linePlot.getValueAxisLineColor(), true, (Comparable<?>)evaluateExpression(linePlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(linePlot.getRangeAxisMaxValueExpression())); XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) jfreeChart.getXYPlot().getRenderer(); boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes(); boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines(); lineRenderer.setBaseShapesVisible(isShowShapes); lineRenderer.setBaseLinesVisible(isShowLines); return jfreeChart; }
Example #30
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
/** * */ protected JFreeChart createXYBarChart() throws JRException { IntervalXYDataset tmpDataset = (IntervalXYDataset)getDataset(); boolean isDate = true; if ( getChart().getDataset().getDatasetType() == JRChartDataset.XY_DATASET ){ isDate = false; } ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createXYBarChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBarPlot)getPlot()).getCategoryAxisLabelExpression()), isDate, evaluateTextExpression(((JRBarPlot)getPlot()).getValueAxisLabelExpression()), tmpDataset, getPlot().getOrientationValue().getOrientation(), isShowLegend(), true, false ); configureChart(jfreeChart, getPlot()); XYPlot xyPlot = (XYPlot)jfreeChart.getPlot(); //plot.setNoDataMessage("No data to display"); // ((XYPlot)plot.getDomainAxis()).setTickMarksVisible( // ((JRBarPlot)getPlot()).isShowTickMarks() // ); // ((CategoryAxis)plot.getDomainAxis()).setTickLabelsVisible( // ((JRBarPlot)getPlot()).isShowTickLabels() // ); // ((NumberAxis)plot.getRangeAxis()).setTickMarksVisible( // ((JRBarPlot)getPlot()).isShowTickMarks() // ); // ((NumberAxis)plot.getRangeAxis()).setTickLabelsVisible( // ((JRBarPlot)getPlot()).isShowTickLabels() // ); XYBarRenderer itemRenderer = (XYBarRenderer)xyPlot.getRenderer(); itemRenderer.setBaseItemLabelGenerator((XYItemLabelGenerator)getLabelGenerator()); itemRenderer.setShadowVisible(false); JRBarPlot barPlot = (JRBarPlot)getPlot(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels(); itemRenderer.setBaseItemLabelsVisible( isShowLabels ); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), barPlot.getCategoryAxisLabelFont(), barPlot.getCategoryAxisLabelColor(), barPlot.getCategoryAxisTickLabelFont(), barPlot.getCategoryAxisTickLabelColor(), barPlot.getCategoryAxisTickLabelMask(), barPlot.getCategoryAxisVerticalTickLabels(), barPlot.getOwnCategoryAxisLineColor(), getDomainAxisSettings(), DateTickUnitType.DAY, (Comparable<?>)evaluateExpression(barPlot.getDomainAxisMinValueExpression()), (Comparable<?>)evaluateExpression(barPlot.getDomainAxisMaxValueExpression()) ); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), barPlot.getValueAxisLabelFont(), barPlot.getValueAxisLabelColor(), barPlot.getValueAxisTickLabelFont(), barPlot.getValueAxisTickLabelColor(), barPlot.getValueAxisTickLabelMask(), barPlot.getValueAxisVerticalTickLabels(), barPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), DateTickUnitType.DAY, (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMinValueExpression()), (Comparable<?>)evaluateExpression(barPlot.getRangeAxisMaxValueExpression()) ); return jfreeChart; }