本文整理汇总了Java中net.sf.jasperreports.engine.JRChartDataset.XY_DATASET属性的典型用法代码示例。如果您正苦于以下问题:Java JRChartDataset.XY_DATASET属性的具体用法?Java JRChartDataset.XY_DATASET怎么用?Java JRChartDataset.XY_DATASET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.sf.jasperreports.engine.JRChartDataset
的用法示例。
在下文中一共展示了JRChartDataset.XY_DATASET属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeXyBarChart
/**
*
*/
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();
}
示例2: writeXyBarChart
/**
*
*/
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();
}
}
示例3: createXYBarChart
/**
*
*/
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;
}
示例4: createXYBarChart
/**
*
*/
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;
}
示例5: getDatasetType
@Override
public byte getDatasetType() {
return JRChartDataset.XY_DATASET;
}
示例6: createChartHyperlinkProvider
/**
*
*/
protected ChartHyperlinkProvider createChartHyperlinkProvider()
{
ChartHyperlinkProvider chartHyperlinkProvider = null;
switch(getChartType())
{
case JRChart.CHART_TYPE_AREA:
case JRChart.CHART_TYPE_BAR:
case JRChart.CHART_TYPE_BAR3D:
case JRChart.CHART_TYPE_LINE:
case JRChart.CHART_TYPE_STACKEDBAR3D:
case JRChart.CHART_TYPE_STACKEDBAR:
case JRChart.CHART_TYPE_STACKEDAREA:
chartHyperlinkProvider = new CategoryChartHyperlinkProvider(((JRFillCategoryDataset)getDataset()).getItemHyperlinks());
break;
case JRChart.CHART_TYPE_BUBBLE:
chartHyperlinkProvider = new XYChartHyperlinkProvider(((JRFillXyzDataset)getDataset()).getItemHyperlinks());
break;
case JRChart.CHART_TYPE_SCATTER:
case JRChart.CHART_TYPE_XYAREA:
case JRChart.CHART_TYPE_XYLINE:
chartHyperlinkProvider = new XYChartHyperlinkProvider(((JRFillXyDataset)getDataset()).getItemHyperlinks());
break;
case JRChart.CHART_TYPE_CANDLESTICK:
case JRChart.CHART_TYPE_HIGHLOW:
chartHyperlinkProvider = new HighLowChartHyperlinkProvider(((JRFillHighLowDataset)getDataset()).getItemHyperlinks());
break;
case JRChart.CHART_TYPE_MULTI_AXIS:
//multi-axis charts are dealt with in createMultiAxisChart
break;
case JRChart.CHART_TYPE_PIE:
case JRChart.CHART_TYPE_PIE3D:
chartHyperlinkProvider = new PieChartHyperlinkProvider(((JRFillPieDataset)getDataset()).getSectionHyperlinks());
break;
case JRChart.CHART_TYPE_TIMESERIES:
chartHyperlinkProvider = new TimeSeriesChartHyperlinkProvider(((JRFillTimeSeriesDataset)getDataset()).getItemHyperlinks());
break;
case JRChart.CHART_TYPE_XYBAR:
switch(getDataset().getDatasetType())
{
case JRChartDataset.TIMESERIES_DATASET :
chartHyperlinkProvider = new TimeSeriesChartHyperlinkProvider(((JRFillTimeSeriesDataset)getDataset()).getItemHyperlinks());
break;
case JRChartDataset.TIMEPERIOD_DATASET :
chartHyperlinkProvider = new TimePeriodChartHyperlinkProvider(((JRFillTimePeriodDataset)getDataset()).getItemHyperlinks());
break;
case JRChartDataset.XY_DATASET :
chartHyperlinkProvider = new XYChartHyperlinkProvider(((JRFillXyDataset)getDataset()).getItemHyperlinks());
break;
default:
break;
}
break;
case JRChart.CHART_TYPE_GANTT:
chartHyperlinkProvider = new XYChartHyperlinkProvider(((JRFillGanttDataset)getDataset()).getItemHyperlinks());
break;
case JRChart.CHART_TYPE_METER:
case JRChart.CHART_TYPE_THERMOMETER:
//no item hyperlinks
break;
default:
throw
new JRRuntimeException(
JRBaseChart.EXCEPTION_MESSAGE_KEY_CHART_TYPE_NOT_SUPPORTED,
new Object[]{getChartType()}
);
}
return chartHyperlinkProvider;
}
示例7: createXYBarChart
/**
*
*/
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().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.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;
}