/** * */ public void writeXyBarChart(JRChart chart) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_xyBarChart, getNamespace()); writeChart(chart); JRChartDataset dataset = chart.getDataset(); if( dataset.getDatasetType() == JRChartDataset.TIMESERIES_DATASET ){ writeTimeSeriesDataset( (JRTimeSeriesDataset)dataset ); } else if( dataset.getDatasetType() == JRChartDataset.TIMEPERIOD_DATASET ){ writeTimePeriodDataset( (JRTimePeriodDataset)dataset ); } else if( dataset.getDatasetType() == JRChartDataset.XY_DATASET ){ writeXyDataset( (JRXyDataset)dataset ); } writeBarPlot((JRBarPlot) chart.getPlot()); writer.closeElement(); }
/** * */ public void writeXyBarChart( JRChart chart, String chartName) { if(chart != null) { write( "JRDesignChart " + chartName + " = new JRDesignChart(jasperDesign, JRChart.CHART_TYPE_XYBAR);\n"); writeChart( chart, chartName); JRChartDataset dataset = chart.getDataset(); if( dataset.getDatasetType() == JRChartDataset.TIMESERIES_DATASET ) { writeTimeSeriesDataset( (JRTimeSeriesDataset)dataset, chartName, "TimeSeriesDataset"); } else if( dataset.getDatasetType() == JRChartDataset.TIMEPERIOD_DATASET ){ writeTimePeriodDataset( (JRTimePeriodDataset)dataset, chartName, "XyDataset"); } else if( dataset.getDatasetType() == JRChartDataset.XY_DATASET ){ writeXyDataset( (JRXyDataset) chart.getDataset(), chartName, "XyDataset"); } writeBarPlot( (JRBarPlot) chart.getPlot(), chartName); flush(); } }
private void verifyChart(JRChart chart) { verifyReportElement(chart); if (chart.getEvaluationTimeValue() == EvaluationTimeEnum.AUTO) { addBrokenRule("Charts do not support Auto evaluation time.", chart); } JRChartDataset dataset = chart.getDataset(); if (dataset == null) { addBrokenRule("Chart dataset missing.", chart); } else { dataset.validate(this); } }
public ANode createNode(ANode parent, Object jrObject, int newIndex) { if (jrObject instanceof JRDesignChart) return new MChart(parent, (JRDesignChart) jrObject, newIndex); if (jrObject instanceof JRDesignChartAxis) { MChartAxes mChartAxes = new MChartAxes(parent, (JRChartAxis) jrObject, newIndex); return mChartAxes; } if (jrObject instanceof JRDesignChartDataset) return ChartDatasetFactory.getChartDataset(parent, (JRChartDataset) jrObject, newIndex); if (jrObject instanceof JRDesignCategorySeries) return new MCategorySeries(parent, (JRDesignCategorySeries) jrObject, newIndex); if (jrObject instanceof JRDesignGanttSeries) return new MGanttSeries(parent, (JRDesignGanttSeries) jrObject, newIndex); if (jrObject instanceof JRDesignPieSeries) return new MPieSeries(parent, (JRDesignPieSeries) jrObject, newIndex); if (jrObject instanceof JRDesignTimePeriodSeries) return new MTimePeriodSeries(parent, (JRDesignTimePeriodSeries) jrObject, newIndex); if (jrObject instanceof JRDesignTimeSeries) return new MTimeSeries(parent, (JRDesignTimeSeries) jrObject, newIndex); if (jrObject instanceof JRDesignXySeries) return new MXYSeries(parent, (JRDesignXySeries) jrObject, newIndex); if (jrObject instanceof JRDesignXyzSeries) return new MXYZSeries(parent, (JRDesignXyzSeries) jrObject, newIndex); return null; }
/** * Construct a new dataset that is a copy of an existing one. * * @param dataset the dataset to copy */ public JRDesignValueDataset(JRChartDataset dataset) { super(dataset); if (dataset == null) { // value datasets hold a single value hence a reset type other // than None doesn't make sense // setting None as default reset type so that it doesn't need to be // explicitly set in order for the dataset to work as expected this.resetTypeValue = ResetTypeEnum.NONE; } }
/** * */ protected JRFillChartDataset( JRChartDataset dataset, JRFillObjectFactory factory ) { super(dataset, factory); }
/** * */ 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().booleanValue(); 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; }
/** * */ 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().booleanValue(); 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; }
/** * */ public JRBasePieDataset(JRChartDataset dataset) { super(dataset); }
@Override public byte getDatasetType() { return JRChartDataset.PIE_DATASET; }
public JRBaseXyzDataset( JRChartDataset dataset){ super( dataset); }
@Override public byte getDatasetType() { return JRChartDataset.XYZ_DATASET; }
/** * */ public JRBaseXyDataset(JRChartDataset dataset) { super(dataset); }
@Override public byte getDatasetType() { return JRChartDataset.XY_DATASET; }
@Override public byte getDatasetType() { return JRChartDataset.TIMESERIES_DATASET; }
/** * */ public JRBaseGanttDataset(JRChartDataset dataset) { super(dataset); }
@Override public byte getDatasetType() { return JRChartDataset.GANTT_DATASET; }
/** * */ public JRBaseHighLowDataset(JRChartDataset dataset) { super(dataset); }
@Override public byte getDatasetType() { return JRChartDataset.HIGHLOW_DATASET; }
@Override public byte getDatasetType() { return JRChartDataset.VALUE_DATASET; }
/** * */ public JRBaseCategoryDataset(JRChartDataset dataset) { super(dataset); }
@Override public byte getDatasetType() { return JRChartDataset.CATEGORY_DATASET; }
@Override public byte getDatasetType() { return JRChartDataset.TIMEPERIOD_DATASET; }
/** * */ public JRDesignHighLowDataset(JRChartDataset dataset) { super(dataset); }
/** * */ public JRDesignGanttDataset(JRChartDataset dataset) { super(dataset); }
/** * */ public JRDesignCategoryDataset(JRChartDataset dataset) { super(dataset); }
/** * */ public JRDesignPieDataset(JRChartDataset dataset) { super(dataset); }
/** * */ public JRDesignTimeSeriesDataset( JRChartDataset dataset ) { super( dataset ); }
/** * */ public JRDesignXyzDataset(JRChartDataset dataset) { super(dataset); }
/** * */ public JRDesignXyDataset(JRChartDataset dataset) { super(dataset); }
/** * */ public JRDesignTimePeriodDataset(JRChartDataset dataset) { super( dataset ); }