我是iReport Designer 5.0.1 的新手,在创建和使用子数据集时遇到问题。XML文件只有一个's列表
。对于每个我想使用.
这是 XML:<incidence>
<incidence>
<sonometria>
<?xml version="1.0" encoding="UTF-8"?>
<incidencias>
<incidencia id="1">
<sonometria>
<lectura>
<fecha>1361780123891</fecha>
<lmax>80.0</lmax>
<leq>68</leq>
<l10>72</l10>
<l90>62</l90>
<limite>90</limite>
</lectura>
<lectura>
<fecha>1361780125994</fecha>
<lmax>82.0</lmax>
<leq>70</leq>
<l10>73</l10>
<l90>65</l90>
<limite>90</limite>
</lectura>
<lectura>
<fecha>1361780127030</fecha>
<lmax>85.0</lmax>
<leq>69</leq>
<l10>71</l10>
<l90>62</l90>
<limite>90</limite>
</lectura>
</sonometria>
</incidencia>
<incidencia id="2">
<sonometria>
<lectura>
<fecha>1361780130155</fecha>
<lmax>85.0</lmax>
<leq>75</leq>
<l10>78</l10>
<l90>66</l90>
<limite>90</limite>
</lectura>
<lectura>
<fecha>1361780131191</fecha>
<lmax>82.0</lmax>
<leq>70</leq>
<l10>73</l10>
<l90>65</l90>
<limite>90</limite>
</lectura>
<lectura>
<fecha>1361780132289</fecha>
<lmax>80.0</lmax>
<leq>65</leq>
<l10>70</l10>
<l90>60</l90>
<limite>90</limite>
</lectura>
</sonometria>
</incidencia>
</incidencias>
主查询为:/incidencias/incidencia
子数据集查询为:/incidencias/incidencia[@id="1"]/sonometria/lectura
. 是的,id="1"
不会很有活力,但这是我还不想面对的另一个问题。
好吧,问题是图表是空的: 所以我不知道问题是子数据集还是使用数据集的图表。这是我的模板:
<?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="incidencias" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="71bf8975-c38f-430a-9743-8924d800c8fc">
<subDataset name="New Dataset 1" uuid="c141c224-fb9f-4de3-851a-ab362f2b336b">
<queryString language="xPath">
<![CDATA[/incidencias/incidencia[@id="1"]/sonometria/lectura]]>
</queryString>
<field name="fecha" class="java.lang.String">
<fieldDescription><![CDATA[fecha]]></fieldDescription>
</field>
<field name="lmax" class="java.lang.String">
<fieldDescription><![CDATA[lmax]]></fieldDescription>
</field>
<field name="l10" class="java.lang.String">
<fieldDescription><![CDATA[l10]]></fieldDescription>
</field>
<field name="leq" class="java.lang.String">
<fieldDescription><![CDATA[leq]]></fieldDescription>
</field>
<field name="l90" class="java.lang.String">
<fieldDescription><![CDATA[l90]]></fieldDescription>
</field>
<field name="limite" class="java.lang.String">
<fieldDescription><![CDATA[limite]]></fieldDescription>
</field>
<field name="id" class="java.lang.String">
<fieldDescription><![CDATA[ancestor::incidencia/@id]]></fieldDescription>
</field>
</subDataset>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\Users\\Alfonso\\Desktop\\"]]></defaultValueExpression>
</parameter>
<queryString language="xPath">
<![CDATA[/incidencias/incidencia]]>
</queryString>
<field name="id" class="java.lang.String">
<fieldDescription><![CDATA[@id]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="52" splitType="Stretch">
<staticText>
<reportElement uuid="de49d5f3-fbc4-4922-aedf-a1ad48b3f8d0" x="0" y="0" width="555" height="52"/>
<textElement textAlignment="Center">
<font size="24" isBold="true"/>
</textElement>
<text><![CDATA[Incidencias]]></text>
</staticText>
</band>
</title>
<columnHeader>
<band height="33" splitType="Stretch">
<staticText>
<reportElement uuid="e8fb4f62-e0b6-43a2-b502-d2482b718097" x="0" y="0" width="100" height="20"/>
<textElement/>
<text><![CDATA[@id]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="162" splitType="Stretch">
<timeSeriesChart>
<chart>
<reportElement uuid="2b58dfb5-85f8-4e5e-bc5d-32f2f14b3503" x="0" y="23" width="555" height="130"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<timeSeriesDataset timePeriod="Second">
<dataset>
<datasetRun subDataset="New Dataset 1" uuid="4a8bc785-e943-4de6-b9cf-a47149a1a3ed"/>
</dataset>
<timeSeries>
<seriesExpression><![CDATA["Ejemplo"]]></seriesExpression>
<timePeriodExpression><![CDATA[new Date($F{fecha})]]></timePeriodExpression>
<valueExpression><![CDATA[Float.parseFloat($F{lmax})]]></valueExpression>
</timeSeries>
</timeSeriesDataset>
<timeSeriesPlot>
<plot/>
</timeSeriesPlot>
</timeSeriesChart>
<textField>
<reportElement uuid="7c330739-e9a2-4879-9410-7b61589fd89e" x="0" y="3" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
我究竟做错了什么?