Jump to content
We've recently updated our Privacy Statement, available here ×

Image quality is blur and not so good


jasperlady

Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

How do you add the chart? Using an image element?

Or using a chart element from JR?

You should post here the JRXML fragment that introduces the chart in the summary.

 

In the meantime, maybe you want to take a look at the samples provided with the JR project distribution.

There are two that might interest you inside /demo/samples/charts and /demo/samples/jfreechart.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

I have one another question too i had two groups in my report and b/w the two groups some space is coming up and i want to get rid of the space i mean i want two group header should touch each other.

 

Is there anyway i can do this?

 

Here is my jasper xml

Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport name="DataSourceReport" pageWidth="595" pageHeight="1100" columnWidth="515" leftMargin="40" rightMargin="40" topMargin="50" bottomMargin="50">
<style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<style name="Arial_Bold" isDefault="false" fontName="Arial" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<style name="Arial_Italic" isDefault="false" fontName="Arial" fontSize="12" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Oblique" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<parameter name="ReportTitle" class="java.lang.String">
</parameter>
<parameter name="DataFile" class="java.lang.String">
</parameter>
<parameter name="SummaryImage" class="java.awt.Image">
</parameter>
<field name="stusCode" class="java.lang.String">
</field>
<field name="yearMonth" class="java.lang.String">
</field>
<field name="totalsOfTheMonth" class="java.lang.Integer">
</field>
<field name="marketingName" class="java.lang.String"></field>
<field name="invokedByCode" class="java.lang.String"></field>

<variable name="monthAllTotal" class="java.lang.Integer" incrementType="Group" incrementGroup="monthGroup" calculation="Count">
<variableExpression><![CDATA[boolean.TRUE]]></variableExpression>
</variable>
<variable name="invokedByTotal" class="java.lang.Integer" incrementType="Group" incrementGroup="invokedGroup" calculation="Count">
<variableExpression><![CDATA[boolean.TRUE]]></variableExpression>
</variable>





<group name="invokedGroup" minHeightToStartNewPage="60">
<groupExpression><![CDATA[$F{invokedByCode}]]></groupExpression>
<groupHeader>
<band height="20">
<textField evaluationTime="Group" evaluationGroup="invokedGroup" bookmarkLevel="1">
<reportElement mode="Opaque" x="0" y="5" width="515" height="15" backcolor="#8A2BE2" forecolor="white" style="Arial_Bold"/>
<box leftPadding="10">
<bottomPen lineWidth="1"/>
</box>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{invokedByTotal}) + ". " + String.valueOf($F{invokedByCode})]]></textFieldExpression>
<anchorNameExpression><![CDATA[string.valueOf($F{invokedByCode})]]></anchorNameExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="20">
<staticText>
<reportElement x="400" y="1" width="60" height="15" style="Arial_Bold"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Count Of:]]></text>
</staticText>
<textField>
<reportElement x="460" y="1" width="30" height="15" style="Arial_Bold"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{invokedGroup_COUNT}]]></textFieldExpression>
</textField>
</band>
</groupFooter>

</group>

<group name="monthGroup" minHeightToStartNewPage="60">
<groupExpression><![CDATA[$F{yearMonth}]]></groupExpression>
<groupHeader>
<band height="20">
<textField evaluationTime="Group" evaluationGroup="monthGroup" bookmarkLevel="1">
<reportElement mode="Opaque" x="0" y="5" width="515" height="15" backcolor="#8A2BE2" forecolor="white" style="Arial_Bold"/>
<box leftPadding="10">
<bottomPen lineWidth="1"/>
</box>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{monthAllTotal}) + ". " + String.valueOf($F{yearMonth})]]></textFieldExpression>
<anchorNameExpression><![CDATA[string.valueOf($F{yearMonth})]]></anchorNameExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="20">
<staticText>
<reportElement x="400" y="1" width="60" height="15" style="Arial_Bold"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Count :]]></text>
</staticText>
<textField>
<reportElement x="460" y="1" width="30" height="15" style="Arial_Bold"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{monthGroup_COUNT}]]></textFieldExpression>
</textField>
</band>
</groupFooter>

</group>




<title>
<band height="70">

<textField isBlankWhenNull="true" bookmarkLevel="1">
<reportElement x="0" y="10" width="515" height="30" style="Arial_Normal"/>
<textElement textAlignment="Center" markup="styled" >
<font size="22" isItalic="true"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["<style color="red" isBold="true">" + $P{ReportTitle} + "</style>"]]></textFieldExpression>
<anchorNameExpression><![CDATA["Title"]]></anchorNameExpression>
</textField>

</band>
</title>

<pageHeader>
<band height="20">

<staticText>
<reportElement mode="Opaque" x="0" y="5" width="155" height="15" forecolor="blue" backcolor="orange" style="Arial_Bold"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[MARKETING NAME]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="155" y="5" width="105" height="15" forecolor="blue" backcolor="orange" style="Arial_Bold"/>
<text><![CDATA[sTATUS CODE]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="260" y="5" width="255" height="15" forecolor="blue" backcolor="orange" style="Arial_Bold"/>
<text><![CDATA[TOTALS]]></text>
</staticText>
</band>
</pageHeader>
<detail>
<band height="15">
<textField bookmarkLevel="2">
<reportElement x="0" y="0" width="155" height="15"/>
<box leftPadding="10" rightPadding="10">
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{marketingName}]]></textFieldExpression>
<anchorNameExpression><![CDATA[$F{marketingName} + " (" + $F{marketingName} + "«»)"]]></anchorNameExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="155" y="0" width="105" height="15"/>
<box leftPadding="10" rightPadding="10">
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{stusCode}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="260" y="0" width="255" height="15"/>
<box leftPadding="10" rightPadding="10">
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{totalsOfTheMonth}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="40">
<line>
<reportElement x="0" y="10" width="515" height="1"/>
<graphicElement/>
</line>
<textField>
<reportElement x="200" y="20" width="80" height="15"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="280" y="20" width="75" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<lastPageFooter>
<band height="60">
<textField bookmarkLevel="1">
<reportElement x="0" y="10" width="515" height="15"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA["There were " +
String.valueOf($V{REPORT_COUNT}) +
" address records on this report."]]></textFieldExpression>
<anchorNameExpression><![CDATA["Summary"]]></anchorNameExpression>
</textField>
<line>
<reportElement x="0" y="30" width="515" height="1"/>
<graphicElement/>
</line>
<textField>
<reportElement x="200" y="40" width="80" height="15"/>
<textElement textAlignment="Right"/>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + String.valueOf($V{PAGE_NUMBER}) + " of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="280" y="40" width="75" height="15"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[" " + String.valueOf($V{PAGE_NUMBER})]]></textFieldExpression>
</textField>
</band>
</lastPageFooter>

<summary>
<band height="300">
<frame>
<reportElement x="0" y="10" width="555" height="290" backcolor="#c0c0c0" mode="Opaque"/>
<box>
<pen lineWidth="1"/>
</box>
<image>
<reportElement x="5" y="5" width="550" height="285"/>
<graphicElement/>
<imageExpression class="java.awt.Image"><![CDATA[$P{SummaryImage}]]></imageExpression>
</image>

</frame>
</band>
</summary>


</jasperReport>
Link to comment
Share on other sites

Hi,

 

If you have other questions, please post them o separate message threads. Do not use the same thread for all your questions because the thread would become a mess and others cannot make use of it.

 

Now, going back to your chart quality questions. It is blur because you generate the chart as image and then include the image in the report. And if you zoom, the image does not scale very well. This is normal.

The solution has already mentioned to you. Look at the /demo/samples/jfreechart sample provided with the project and you will see that we are wrapping the JFreeChart object into a special JRRenderable implementation that makes sure JFreeChart will draw the chart directly on the graphic device at runtime as a SVG, thus preserving chart quality.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...