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
protected JFreeChart createTimeSeriesChart() throws JRException { String timeAxisLabel = (String) evaluateExpression( ((JRTimeSeriesPlot) getPlot()).getTimeAxisLabelExpression()); String valueAxisLabel = (String) evaluateExpression( ((JRTimeSeriesPlot) getPlot()).getValueAxisLabelExpression()); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createTimeSeriesChart( (String) evaluateExpression(getChart().getTitleExpression()), timeAxisLabel, valueAxisLabel, (TimeSeriesCollection) getDataset(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); XYPlot xyPlot = (XYPlot) jfreeChart.getPlot(); JRTimeSeriesPlot timeSeriesPlot = (JRTimeSeriesPlot) getPlot(); XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) xyPlot.getRenderer(); boolean isShowShapes = timeSeriesPlot.getShowShapes() == null ? true : timeSeriesPlot.getShowShapes().booleanValue(); boolean isShowLines = timeSeriesPlot.getShowLines() == null ? true : timeSeriesPlot.getShowLines().booleanValue(); lineRenderer.setBaseLinesVisible(isShowLines); lineRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), timeSeriesPlot.getTimeAxisLabelFont(), timeSeriesPlot.getTimeAxisLabelColor(), timeSeriesPlot.getTimeAxisTickLabelFont(), timeSeriesPlot.getTimeAxisTickLabelColor(), timeSeriesPlot.getTimeAxisTickLabelMask(), timeSeriesPlot.getTimeAxisVerticalTickLabels(), timeSeriesPlot.getOwnTimeAxisLineColor(), false, (Comparable) evaluateExpression(timeSeriesPlot.getDomainAxisMinValueExpression()), (Comparable) evaluateExpression(timeSeriesPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), timeSeriesPlot.getValueAxisLabelFont(), timeSeriesPlot.getValueAxisLabelColor(), timeSeriesPlot.getValueAxisTickLabelFont(), timeSeriesPlot.getValueAxisTickLabelColor(), timeSeriesPlot.getValueAxisTickLabelMask(), timeSeriesPlot.getValueAxisVerticalTickLabels(), timeSeriesPlot.getOwnValueAxisLineColor(), true, (Comparable) evaluateExpression(timeSeriesPlot.getRangeAxisMinValueExpression()), (Comparable) evaluateExpression(timeSeriesPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
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);/* ww w. ja v a 2 s .c om*/ 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; }
From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java
protected JFreeChart createTimeSeriesChart() throws JRException { String timeAxisLabel = (String) evaluateExpression( ((JRTimeSeriesPlot) getPlot()).getTimeAxisLabelExpression()); String valueAxisLabel = (String) evaluateExpression( ((JRTimeSeriesPlot) getPlot()).getValueAxisLabelExpression()); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createTimeSeriesChart( (String) evaluateExpression(getChart().getTitleExpression()), timeAxisLabel, valueAxisLabel, (TimeSeriesCollection) getDataset(), isShowLegend(), true, false); configureChart(jfreeChart, getPlot()); XYPlot xyPlot = (XYPlot) jfreeChart.getPlot(); JRTimeSeriesPlot timeSeriesPlot = (JRTimeSeriesPlot) getPlot(); XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) xyPlot.getRenderer(); boolean isShowShapes = timeSeriesPlot.getShowShapes() == null ? true : timeSeriesPlot.getShowShapes().booleanValue(); boolean isShowLines = timeSeriesPlot.getShowLines() == null ? true : timeSeriesPlot.getShowLines().booleanValue(); lineRenderer.setBaseLinesVisible(isShowLines); lineRenderer.setBaseShapesVisible(isShowShapes); // Handle the axis formating for the category axis configureAxis(xyPlot.getDomainAxis(), timeSeriesPlot.getTimeAxisLabelFont(), timeSeriesPlot.getTimeAxisLabelColor(), timeSeriesPlot.getTimeAxisTickLabelFont(), timeSeriesPlot.getTimeAxisTickLabelColor(), timeSeriesPlot.getTimeAxisTickLabelMask(), timeSeriesPlot.getTimeAxisVerticalTickLabels(), timeSeriesPlot.getOwnTimeAxisLineColor(), getDomainAxisSettings(), DateTickUnit.DAY, (Comparable) evaluateExpression(timeSeriesPlot.getDomainAxisMinValueExpression()), (Comparable) evaluateExpression(timeSeriesPlot.getDomainAxisMaxValueExpression())); // Handle the axis formating for the value axis configureAxis(xyPlot.getRangeAxis(), timeSeriesPlot.getValueAxisLabelFont(), timeSeriesPlot.getValueAxisLabelColor(), timeSeriesPlot.getValueAxisTickLabelFont(), timeSeriesPlot.getValueAxisTickLabelColor(), timeSeriesPlot.getValueAxisTickLabelMask(), timeSeriesPlot.getValueAxisVerticalTickLabels(), timeSeriesPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(), DateTickUnit.DAY, (Comparable) evaluateExpression(timeSeriesPlot.getRangeAxisMinValueExpression()), (Comparable) evaluateExpression(timeSeriesPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java
/** * *//*from w ww. j a v a 2s.c o m*/ 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(), false, (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(), true, (Comparable<?>) evaluateExpression(barPlot.getRangeAxisMinValueExpression()), (Comparable<?>) evaluateExpression(barPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java
/** * */// w w w . java 2 s. c o m protected JFreeChart createGanttChart() throws JRException { //FIXMECHART legend/tooltip/url should come from plot? ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createGanttChart( (String) evaluateExpression(getChart().getTitleExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getCategoryAxisLabelExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getValueAxisLabelExpression()), (GanttCategoryDataset) getDataset(), isShowLegend(), true, //FIXMECHART tooltip: I guess BarPlot is not the best for gantt false); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot(); //plot.setNoDataMessage("No data to display"); JRBarPlot barPlot = (JRBarPlot) getPlot(); 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); // 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, null, null); ((DateAxis) categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks); ((DateAxis) categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels); // 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())); BarRenderer categoryRenderer = (BarRenderer) categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator()); categoryRenderer.setBaseItemLabelsVisible(isShowLabels); categoryRenderer.setShadowVisible(false); return jfreeChart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
/** * *//*from w ww .j a va 2 s . co m*/ 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; }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
/** * *//* w ww . j a va 2 s .c om*/ 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; }
From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java
/** * *//* ww w . ja v a 2s . c o m*/ protected JFreeChart createGanttChart() throws JRException { //FIXMECHART legend/tooltip/url should come from plot? ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createGanttChart( (String) evaluateExpression(getChart().getTitleExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getCategoryAxisLabelExpression()), (String) evaluateExpression(((JRBarPlot) getPlot()).getValueAxisLabelExpression()), (GanttCategoryDataset) getDataset(), isShowLegend(), true, //FIXMECHART tooltip: I guess BarPlot is not the best for gantt false); configureChart(jfreeChart, getPlot()); CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot(); //plot.setNoDataMessage("No data to display"); JRBarPlot barPlot = (JRBarPlot) getPlot(); 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(); //FIXMETHEME these are useless if the theme settings apply after regardless of these; check all categoryPlot.getDomainAxis().setTickMarksVisible(isShowTickMarks); categoryPlot.getDomainAxis().setTickLabelsVisible(isShowTickLabels); // 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())); ((DateAxis) categoryPlot.getRangeAxis()).setTickMarksVisible(isShowTickMarks); ((DateAxis) categoryPlot.getRangeAxis()).setTickLabelsVisible(isShowTickLabels); // 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())); BarRenderer categoryRenderer = (BarRenderer) categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator()); categoryRenderer.setBaseItemLabelsVisible(isShowLabels); categoryRenderer.setShadowVisible(false); return jfreeChart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
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);/* www .j a v a 2 s. c o m*/ 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; }
From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java
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(), 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.getOwnValueAxisLineColor(), 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; }