我想用 Google Chart API 绘制数据图表并在 Jasperserver Pro 5.2 中显示结果。我创建了一个 HTML-Componente,其中包含包含
<script type='text/javascript' src='https://www.google.com/jsapi'>
标签的完整 HTML 代码。HTML 导出在 iReport 中工作正常,但在 jasperserver 上调用 HTML 组件时仍为空。没有错误信息。(顺便说一句:当使用我的 iphone 从 iOS 7.0.1(jaspersoft 应用程序)调用时,页面显示正确。)我尝试使用不同的浏览器,但总是相同的东西。
任何人都可以帮忙吗?
请在附件中找到 JRXML
这是 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="HtmlComponentReport" pageWidth="595" pageHeight="842" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50" uuid="b4ad5fd2-ee36-4fc4-a326-5600945b4633">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="JRProjectID" class="java.lang.Integer">
<defaultValueExpression><![CDATA[Integer.valueOf(287)]]></defaultValueExpression>
</parameter>
<parameter name="chart" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["<!DOCTYPE html><html><head><script type='text/javascript' src='https://www.google.com/jsapi'></script><script type='text/javascript'>google.load('visualization', '1.0', {'packages':['corechart']});; google.setOnLoadCallback(drawChart);function drawChart() {var data = new google.visualization.DataTable();data.addColumn('string', 'Topping');data.addColumn('number', 'Slices');data.addRows('Mushrooms', 3],['Onions', 1],['Olives', 1],['Zucchini', 1],['Pepperoni', 2);var options = {'title':'How Much Pizza I Ate Last Night', 'width':400,'height':300};var chart = new google.visualization.PieChart(document.getElementById('chart_div'));chart.draw(data, options);}</script></head><body><div id='chart_div' style='width:400; height:300'></div></body></html>"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select 1 as dummy]]>
</queryString>
<field name="dummy" class="java.lang.Integer"/>
<title>
<band height="502">
<componentElement>
<reportElement uuid="13361114-deb3-40d4-be5d-913b157ba7d3" x="0" y="0" width="515" height="472" backcolor="#ADD8E6"/>
<hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="FillFrame" horizontalAlign="Left" verticalAlign="Top">
<hc:htmlContentExpression><![CDATA[$P{chart}]]></hc:htmlContentExpression>
</hc:html>
</title>
</jasperReport>
谢谢你的帮助!