我有一个具有遥控器的代码:
@Controller
public class ReportsController {
@RequestMapping(value="report.htm",method=RequestMethod.GET)
public String showReport() throws JRException{
...
InputStream reportStream = this.getClass().getResourceAsStream("/report.jrxml");
JRDataSource dataSource = new JRBeanCollectionDataSource(reportData);
HashMap params = new HashMap();
params.put("Title", "Report");
JasperDesign jd = JRXmlLoader.load(reportStream);
JasperReport jr = JasperCompileManager.compileReport(jd);
JasperPrint jp = JasperFillManager.fillReport(jr, params, dataSource);
JRHtmlExporter exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
//EXPORTING REPORT TO A FILE "myreport.html"
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "E:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/mywebapp/WEB-INF/jsps/reports/reportsOutput/myreport.html"); //--------statement (1)
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, false);
exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, true);
exporter.exportReport();
return "report";
}
}
在声明(1)我出口我生成的报告的文件myreport.html。
我的报告模板文件(report.jrxml)是:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report5" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="count" class="java.lang.Integer"/>
<field name="status" class="java.lang.String"/>
<background>
<band/>
</background>
<detail>
<band height="343">
<textField>
<reportElement mode="Transparent" x="8" y="14" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{count}]]></textFieldExpression>
</textField>
<textField>
<reportElement mode="Transparent" x="267" y="14" width="100" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{status}]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Transparent" x="146" y="14" width="100" height="20"/>
<textElement/>
<text><![CDATA[status]]></text>
</staticText>
<barChart>
<chart>
<reportElement mode="Transparent" x="108" y="119" width="200" height="100"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<categorySeries>
<seriesExpression><![CDATA[""]]></seriesExpression>
<categoryExpression><![CDATA[$F{status}]]></categoryExpression>
<valueExpression><![CDATA[$F{count}]]></valueExpression>
<itemHyperlink/>
</categorySeries>
</categoryDataset>
<barPlot>
<plot/>
</barPlot>
</barChart>
</band>
</detail>
</jasperReport>
问题是,在我的myreport.html
生成报告显示的一切,但没有显示任何条形图,而不是显示在地方图表的空白空间。
有什么建议么?
编辑:
数据到图表由语句JasperPrint jp = JasperFillManager.fillReport(jr, params, dataSource);
在上面的代码提供。
此外有产生,由碧玉报告API,在那里是我的输出文件(myreport.html)相同的目录文件夹所在如下:
/mywebapp/WEB-INF/jsps/reports/reportsOutput/myreport.html(输出文件)
/mywebapp/WEB-INF/jsps/reports/reportsOutput/myreport.html_files(生成的文件夹)
这个生成的文件夹(myreport.html_files)包含生成根据模板图表图像和正确无误,但这些图表图象不与报告的其他文本输出一起示出了在输出文件myreport.html。谢谢...
如果有多种颜色条,它们会被显示在一个越来越弱阴影。导出为PDF,你可能看到他们