有什么建议吗?图表中的数据由上述代码中的语句JasperPrint jp = JasperFillManager.fillReport(jr, params, dataSource);提供.此外,在我的输出文件(myreport.html)所在的目录中,有一个由jasper report API生成的文件夹,位于:/mywebapp/WEB-INF/jsps/reports/reportsOutput/ myreport.html (输出文件)/mywebapp/WEB-INF/jsps/reports/reportsOutput/ myreport.html_files (生成的文件夹)此生成的文件夹(myreport.html_files)包含根据模板生成的图表图像,并且是正确的,但是这些图表图像并未与其他文本输出一起显示在输出文件myreport.html 中.报告.谢谢... 解决方案如果存在多种颜色的条形,它们将以越来越弱的阴影显示.导出为PDF,您可能会看到它们I have a report controller having code:@Controllerpublic 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"; }}In statement (1) I am exporting my generated report to a file myreport.html.My report template file (report.jrxml) is:<?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>Problem is that my generated report in myreport.html is showing everything but does not show any bar chart, instead showing blank white space in place of chart.Any suggestions?EDIT:Data to chart is provided by statement JasperPrint jp = JasperFillManager.fillReport(jr, params, dataSource); in the above code.Moreover there is a folder generated, by jasper reports API, in the same dir in which there is my output file (myreport.html) lies as:/mywebapp/WEB-INF/jsps/reports/reportsOutput/myreport.html (Output file)/mywebapp/WEB-INF/jsps/reports/reportsOutput/myreport.html_files (generated folder)This generated folder (myreport.html_files) contains generated chart images according to template and are correct but these chart images are not being shown up in the output file myreport.html along with other text output of report.Thanks... 解决方案 If there are bars of multiple colors, they will be displayed in a weaker and weaker shade. Export to PDF and you may see them 这篇关于生成的碧玉报告未显示条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-09 20:28