List of usage examples for org.jfree.chart StandardChartTheme createLegacyTheme
public static ChartTheme createLegacyTheme()
From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java
/** * *///w ww. j av 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( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBarPlot) getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((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(); boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels(); 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.chartthemes.simple.SimpleChartTheme.java
/** * *///from w w w . j av a 2 s . c om protected JFreeChart createGanttChart() throws JRException { //FIXMECHART legend/tooltip/url should come from plot? ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createGanttChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBarPlot) getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((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(); boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels(); //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 createTimeSeriesChart() throws JRException { String timeAxisLabel = evaluateTextExpression(((JRTimeSeriesPlot) getPlot()).getTimeAxisLabelExpression()); String valueAxisLabel = evaluateTextExpression( ((JRTimeSeriesPlot) getPlot()).getValueAxisLabelExpression()); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createTimeSeriesChart( evaluateTextExpression(getChart().getTitleExpression()), timeAxisLabel, valueAxisLabel, (TimeSeriesCollection) getDataset(), isShowLegend(), true, false); configureChart(jfreeChart);//from ww w . j a v a 2 s.c o m XYPlot xyPlot = (XYPlot) jfreeChart.getPlot(); JRTimeSeriesPlot timeSeriesPlot = (JRTimeSeriesPlot) getPlot(); XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) xyPlot.getRenderer(); boolean isShowShapes = timeSeriesPlot.getShowShapes() == null ? true : timeSeriesPlot.getShowShapes(); boolean isShowLines = timeSeriesPlot.getShowLines() == null ? true : timeSeriesPlot.getShowLines(); 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.getTimeAxisLineColor(), 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.getValueAxisLineColor(), true, (Comparable<?>) evaluateExpression(timeSeriesPlot.getRangeAxisMinValueExpression()), (Comparable<?>) evaluateExpression(timeSeriesPlot.getRangeAxisMaxValueExpression())); return jfreeChart; }
From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java
/** * *//*from w w w . j a v a 2 s .c om*/ protected JFreeChart createGanttChart() throws JRException { //FIXMECHART legend/tooltip/url should come from plot? ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); JFreeChart jfreeChart = ChartFactory.createGanttChart( evaluateTextExpression(getChart().getTitleExpression()), evaluateTextExpression(((JRBarPlot) getPlot()).getCategoryAxisLabelExpression()), evaluateTextExpression(((JRBarPlot) getPlot()).getValueAxisLabelExpression()), (GanttCategoryDataset) getDataset(), isShowLegend(), true, //FIXMECHART tooltip: I guess BarPlot is not the best for gantt false); configureChart(jfreeChart); CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot(); //plot.setNoDataMessage("No data to display"); JRBarPlot barPlot = (JRBarPlot) getPlot(); boolean isShowTickMarks = barPlot.getShowTickMarks() == null ? true : barPlot.getShowTickMarks(); boolean isShowTickLabels = barPlot.getShowTickLabels() == null ? true : barPlot.getShowTickLabels(); boolean isShowLabels = barPlot.getShowLabels() == null ? false : barPlot.getShowLabels(); 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.getCategoryAxisLineColor(), 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.getValueAxisLineColor(), true, (Comparable<?>) evaluateExpression(barPlot.getRangeAxisMinValueExpression()), (Comparable<?>) evaluateExpression(barPlot.getRangeAxisMaxValueExpression())); GanttRenderer categoryRenderer = (GanttRenderer) categoryPlot.getRenderer(); categoryRenderer.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator()); categoryRenderer.setBaseItemLabelsVisible(isShowLabels); categoryRenderer.setShadowVisible(false); return jfreeChart; }