Java 类net.sf.jasperreports.engine.JRChartDataset 实例源码

项目:jasperreports    文件:JRXmlWriter.java   
/**
 *
 */
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();
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 *
 */
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();
    }
}
项目:jasperreports    文件:JRVerifier.java   
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);
    }
}
项目:PDFReporter-Studio    文件:ChartComponentFactory.java   
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;
}
项目:jasperreports    文件:JRDesignValueDataset.java   
/**
 * 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;
    }
}
项目:jasperreports    文件:JRFillChartDataset.java   
/**
 *
 */
protected JRFillChartDataset(
    JRChartDataset dataset, 
    JRFillObjectFactory factory
    )
{
    super(dataset, factory);
}
项目:jasperreports    文件:GenericChartTheme.java   
/**
     *
     */
    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;
    }
项目:jasperreports    文件:SimpleChartTheme.java   
/**
     *
     */
    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;
    }
项目:jasperreports    文件:JRBasePieDataset.java   
/**
 *
 */
public JRBasePieDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRBasePieDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.PIE_DATASET;
}
项目:jasperreports    文件:JRBaseXyzDataset.java   
public JRBaseXyzDataset( JRChartDataset dataset){
    super( dataset);
}
项目:jasperreports    文件:JRBaseXyzDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.XYZ_DATASET;
}
项目:jasperreports    文件:JRBaseXyDataset.java   
/**
 *
 */
public JRBaseXyDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRBaseXyDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.XY_DATASET;
}
项目:jasperreports    文件:JRBaseTimeSeriesDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.TIMESERIES_DATASET;
}
项目:jasperreports    文件:JRBaseGanttDataset.java   
/**
 *
 */
public JRBaseGanttDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRBaseGanttDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.GANTT_DATASET;
}
项目:jasperreports    文件:JRBaseHighLowDataset.java   
/**
 *
 */
public JRBaseHighLowDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRBaseHighLowDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.HIGHLOW_DATASET;
}
项目:jasperreports    文件:JRBaseValueDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.VALUE_DATASET;
}
项目:jasperreports    文件:JRBaseCategoryDataset.java   
/**
 *
 */
public JRBaseCategoryDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRBaseCategoryDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.CATEGORY_DATASET;
}
项目:jasperreports    文件:JRBaseTimePeriodDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.TIMEPERIOD_DATASET;
}
项目:jasperreports    文件:JRDesignHighLowDataset.java   
/**
 *
 */
public JRDesignHighLowDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRDesignHighLowDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.HIGHLOW_DATASET;
}
项目:jasperreports    文件:JRDesignGanttDataset.java   
/**
 *
 */
public JRDesignGanttDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRDesignGanttDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.GANTT_DATASET;
}
项目:jasperreports    文件:JRDesignCategoryDataset.java   
/**
 *
 */
public JRDesignCategoryDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRDesignCategoryDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.CATEGORY_DATASET;
}
项目:jasperreports    文件:JRDesignPieDataset.java   
/**
 *
 */
public JRDesignPieDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRDesignPieDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.PIE_DATASET;
}
项目:jasperreports    文件:JRDesignTimeSeriesDataset.java   
/**
 * 
 */
public JRDesignTimeSeriesDataset( JRChartDataset dataset )
{
    super( dataset );
}
项目:jasperreports    文件:JRDesignTimeSeriesDataset.java   
@Override
public byte getDatasetType() 
{
    return JRChartDataset.TIMESERIES_DATASET;
}
项目:jasperreports    文件:JRDesignXyzDataset.java   
/**
 *
 */
public JRDesignXyzDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRDesignXyzDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.XYZ_DATASET;
}
项目:jasperreports    文件:JRDesignXyDataset.java   
/**
 *
 */
public JRDesignXyDataset(JRChartDataset dataset)
{
    super(dataset);
}
项目:jasperreports    文件:JRDesignXyDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.XY_DATASET;
}
项目:jasperreports    文件:JRDesignTimePeriodDataset.java   
/**
 * 
 */
public JRDesignTimePeriodDataset(JRChartDataset dataset)
{
    super( dataset );
}
项目:jasperreports    文件:JRDesignTimePeriodDataset.java   
@Override
public byte getDatasetType() 
{
    return JRChartDataset.TIMEPERIOD_DATASET;
}
项目:jasperreports    文件:JRFillValueDataset.java   
@Override
public byte getDatasetType() {
    return JRChartDataset.VALUE_DATASET;
}