如何在timeSeriesChart中显示jasper报告中的值

时间:2013-11-21 06:22:20

标签: java jasper-reports

我想在timeSeriesChart中显示值和日期。我找不到任何可以指导我的任何财产......

这是我想要的形象 enter image description here

和我的代码

<?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="report1"  language="java" 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="144"/>
    <queryString language="SQL">
        <![CDATA[SELECT    tbMeasurement.measurementName, tbPatientMeasurement.measurementValue,   REPLACE(REPLACE(REPLACE(CONVERT(CHAR(19), CONVERT(DATETIME,
                      DATEADD(month, - 1, dbo.tbPatientMeasurement.Taken), 101), 121), '-', ','), ' ', ','), ':', ',') AS Created
FROM         tbPatientMeasurement INNER JOIN
                     tbMeasurement ON tbPatientMeasurement.MeasurementIDF = tbMeasurement.MeasurementIDP]]>
    </queryString>
    <field name="measurementName" class="java.lang.String"/>
    <field name="measurementValue" class="java.lang.String"/>
    <field name="created" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <summary>
        <band height="648" splitType="Stretch">
            <timeSeriesChart>
                <chart isShowLegend="true" renderType="draw">
                    <reportElement x="0" y="251" width="555" height="248" isPrintWhenDetailOverflows="true"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <timeSeriesDataset>
                    <timeSeries>
                        <seriesExpression><![CDATA[$F{measurementName}]]></seriesExpression>
                        <timePeriodExpression><![CDATA[new SimpleDateFormat("yyyy,MM,dd,HH,mm").parse($F{created})]]></timePeriodExpression>
                        <valueExpression><![CDATA[Integer.valueOf($F{measurementValue})]]></valueExpression>
                    </timeSeries>
                </timeSeriesDataset>
                <timeSeriesPlot isShowLines="true" isShowShapes="true">
                    <plot backgroundAlpha="1.0" labelRotation="55.0"/>

<timeAxisFormat>

<axisFormat  tickLabelMask="dd-MM-yyyy hh:mm" verticalTickLabels="true" />

</timeAxisFormat>
                </timeSeriesPlot>
            </timeSeriesChart>
        </band>
    </summary>
</jasperReport>

0 个答案:

没有答案