【问题标题】:Steps to include a class with datatype UniqueCategoryLabel包含数据类型为 UniqueCategoryLabel 的类的步骤
【发布时间】:2015-08-31 19:12:17
【问题描述】:

您能否告诉我在 Jasperreportstudio 6.1 或 Jasperreportserver 6.1 中包含数据类型 UniqueCategoryLabel 的 .class 的步骤 描述于Jasper report Line chart Category expression same value is printed only once

在将字段的类从 java.lang.String 更改为 class="java.lang.UniqueCategoryLabel" 后,我总是收到消息“java.lang.ClassNotFoundException: java.lang.UniqueCategoryLabel”。 我没有感觉,包含一个 .class 文件就足以在 JasperReportStudio 中解决这个问题。

问候

雷纳

【问题讨论】:

  • 你能显示代码吗?

标签: java jasper-reports classnotfoundexception


【解决方案1】:

感谢您的回复。

消息

java.lang.ClassNotFoundException: java.lang.UniqueCategoryLabel
refers to the modification from 
<field name="charge" class="java.lang.String"   to 
<field name="charge" class="java.lang.UniqueCategoryLabel"

这是文章中推荐的。 我希望这对你来说已经足够了。如果您需要更多信息,请现在告诉我。 特此报告代码:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.0.final using JasperReports Library version 6.1.0  -->
<!-- 2015-08-31T11:45:11 -->
<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="ic_A4_1" pageWidth="1190" pageHeight="842" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="fdc0bd49-2d10-4f3e-bbef-032ce95cbb2b">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Postgres Lokal (Postgres auf localhost 5432)"/>
    <property name="com.jaspersoft.studio.unit." value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
    <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
    <parameter name="Materialnr" class="java.lang.Long">
        <parameterDescription><![CDATA[Materialnummer eingeben]]></parameterDescription>
    </parameter>
    <parameter name="Feldstaerke" class="java.util.Collection">
        <parameterDescription><![CDATA[Feldstärke]]></parameterDescription>
    </parameter>
    <parameter name="Zeitraum" class="java.lang.Long">
        <parameterDescription><![CDATA[Zeitraum]]></parameterDescription>
    </parameter>
    <parameter name="Chargennr" class="java.util.Collection">
        <parameterDescription><![CDATA[Chargennummer]]></parameterDescription>
    </parameter>
    <queryString>
        <![CDATA[select charge, avg(ic_ist_tc) as ic, 
0 as ic_charge,messdatum  from tbl_physikal_eigensch 
where $X{IN,charge, Chargennr}   and matnr = $P{Materialnr} and $X{IN,cast(feld as text),Feldstaerke} and 
messdatum > CURRENT_DATE -  $P!{Zeitraum} group by ic_ist_tc, charge, messdatum]]>
    </queryString>
    <field name="charge" class="**java.lang.UniqueCategoryLabel**"/>
    <field name="ic" class="java.lang.Double"/>
    <field name="ic_charge" class="java.lang.Integer"/>
    <field name="messdatum" class="java.sql.Timestamp"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch">
            <textField>
                <reportElement x="140" y="10" width="310" height="30" uuid="7e5a58f0-bef2-4a19-9e3d-8463fd183e97"/>
                <textElement>
                    <font size="16" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["Test für Wolkenauswertung"]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <pageHeader>
        <band height="35" splitType="Stretch">
            <textField>
                <reportElement x="0" y="4" width="141" height="30" uuid="1cdaa2f5-9de1-4a49-b64a-18e9c797523f"/>
                <textFieldExpression><![CDATA[$P{Materialnr}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="141" y="4" width="138" height="30" uuid="cfdcf595-23fb-463a-b785-686328dcba27"/>
                <textFieldExpression><![CDATA[$P{Feldstaerke}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="279" y="4" width="138" height="30" uuid="7b14cbf7-61ec-4cff-90b0-03020753dc48"/>
                <textFieldExpression><![CDATA[$P{Zeitraum}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="417" y="4" width="138" height="30" uuid="2b8b6fc8-c6a3-46d4-988d-8c7852e63c65"/>
                <textFieldExpression><![CDATA[$P{Chargennr}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="39" splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="44" splitType="Stretch">
            <printWhenExpression><![CDATA[$F{charge} != null]]></printWhenExpression>
            <textField>
                <reportElement x="0" y="0" width="141" height="30" uuid="b3c2fa4f-15c4-470f-91e1-38647e4a9d5c"/>
                <textFieldExpression><![CDATA[$F{charge}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="141" y="0" width="138" height="30" uuid="21d7eb63-4854-4be7-af38-42b7339dceaf"/>
                <textFieldExpression><![CDATA[$F{ic}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="279" y="0" width="138" height="30" uuid="e2b21f1c-d6c5-4063-83d1-02ea6781e116"/>
                <textFieldExpression><![CDATA[$F{ic_charge}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="417" y="0" width="138" height="30" uuid="55d01538-9498-4bf8-a5ee-f354d4def1c4"/>
                <textFieldExpression><![CDATA[$F{messdatum}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="801" splitType="Stretch">
            <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
            <lineChart>
                <chart evaluationTime="Report">
                    <reportElement stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="0" y="0" width="500" height="350" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="1ab5eddf-90e6-4356-b819-687ea0c6c514"/>
                    <chartTitle>
                        <titleExpression><![CDATA[$P{Materialnr}]]></titleExpression>
                    </chartTitle>
                    <chartSubtitle/>
                    <chartLegend position="Bottom">
                        <font size="8"/>
                    </chartLegend>
                </chart>
                <categoryDataset>
                    <dataset resetType="None" incrementType="Report"/>
                    <categorySeries>
                        <seriesExpression><![CDATA["CHARGE"]]></seriesExpression>
                        <categoryExpression><![CDATA[$F{charge}]]></categoryExpression>
                        <valueExpression><![CDATA[$F{ic}]]></valueExpression>
                    </categorySeries>
                    <categorySeries>
                        <seriesExpression><![CDATA["CHARGE2"]]></seriesExpression>
                        <categoryExpression><![CDATA[$F{charge}]]></categoryExpression>
                        <valueExpression><![CDATA[$F{ic}]]></valueExpression>
                    </categorySeries>
                </categoryDataset>
                <linePlot>
                    <plot backgroundAlpha="1.0" foregroundAlpha="1.0" labelRotation="-90.0">
                        <seriesColor seriesOrder="0" color="#EB2902"/>
                        <seriesColor seriesOrder="1" color="#38C83B"/>
                    </plot>
                    <categoryAxisFormat labelRotation="-90.0">
                        <axisFormat tickLabelColor="#0A0A0A" verticalTickLabels="false">
                            <labelFont>
                                <font size="2"/>
                            </labelFont>
                            <tickLabelFont>
                                <font size="8"/>
                            </tickLabelFont>
                        </axisFormat>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat>
                            <labelFont>
                                <font size="8"/>
                            </labelFont>
                            <tickLabelFont>
                                <font size="8"/>
                            </tickLabelFont>
                        </axisFormat>
                    </valueAxisFormat>
                </linePlot>
            </lineChart>
        </band>
    </summary>
</jasperReport>

【讨论】:

  • 您好,我是 stackexchange 的新手。请将此答案提交给撰写此问题的 brodhagen8115。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-29
  • 2021-12-26
  • 2013-10-13
  • 2013-04-21
相关资源
最近更新 更多