Example usage for org.jfree.chart StandardChartTheme createLegacyTheme

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

Introduction

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

Prototype

public static ChartTheme createLegacyTheme() 

Source Link

Document

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

Usage

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

/**
 *
 *///from w  ww  .j av  a  2 s .  c  om
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

/**
 *
 *///www  .  ja va2 s.  co  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(),
            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

/**
 *
 *//*from   www  .  j ava2 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();

    //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. ja  v a2  s.  c om*/

    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;
}

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

/**
 *
 *///w  ww  .ja  v  a  2 s  .  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);

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    //plot.setNoDataMessage("No data to display");
    //      ((XYPlot)plot.getDomainAxis()).setTickMarksVisible(
    //         ((JRFillBarPlot)getPlot()).isShowTickMarks()
    //         );
    //      ((CategoryAxis)plot.getDomainAxis()).setTickLabelsVisible(
    //            ((JRFillBarPlot)getPlot()).isShowTickLabels()
    //            );
    //      ((NumberAxis)plot.getRangeAxis()).setTickMarksVisible(
    //            ((JRFillBarPlot)getPlot()).isShowTickMarks()
    //            );
    //      ((NumberAxis)plot.getRangeAxis()).setTickLabelsVisible(
    //            ((JRFillBarPlot)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.getCategoryAxisLineColor(), 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.getValueAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(barPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(barPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.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(),
            getDomainAxisSettings(),/*from  w ww .j a v  a2 s.  c o  m*/
            (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;
}

From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.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, getPlot());

    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.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 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, getPlot());

    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.getOwnTimeAxisLineColor(),
            getDomainAxisSettings(), DateTickUnitType.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(), DateTickUnitType.DAY,
            (Comparable<?>) evaluateExpression(timeSeriesPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(timeSeriesPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.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);// ww  w  . j av  a  2s.co  m

    // 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;
}