Jump to content
Changes to the Jaspersoft community edition download ×

Changing font size in Chart Legend


Recommended Posts

  • 2 months later...
  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

i think that the <chartLegend> tag doesnt work properly. in my MessageBundle i have for example "0x010D"

(0xE8 0x010D #LATIN SMALL LETTER C WITH CARON)

and changing the font of chart's legend to CP1250 makes this character vanish. some other characters with carons display properly but some dont. the problem is, that in my report (all textfield in CP1250) all of these chars are ok but in the chart the arent displayed. am i doing st wrong? is there any workaround for this?

Link to comment
Share on other sites

Hi,

 

In the new version for irReports, you can set it as a chart property. I'm using Jasper Reports/iReport-1.2.8.

 

to get there

 

-- Double click on the chart

-- Click on the Chart tab

-- Click edit chart properties

 

Go to the parameter -- Legend Font. You can change it here.

 

or you can change it in the jrxml. Here's my Pie Chart xml form the jrxml file. Your JasperReports version needs to be 1.2.7+

 

<pieChart>

<chart hyperlinkTarget="Self" customizerClass="TestFormat" >

<reportElement

x="14"

y="13"

width="170"

height="134"

key="element-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<chartLegend textColor="#000000" backgroundColor="#FFFFFF" >

<font fontName="SansSerif" pdfFontName="Helvetica" size="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/>

</chartLegend>

</chart>

<pieDataset>

<dataset resetType="Group" resetGroup="Traits" >

</dataset>

<keyExpression><![CDATA[$F{SCORE}]]></keyExpression>

<valueExpression><![CDATA[$F{COUNT}]]></valueExpression>

<labelExpression><![CDATA[null]]></labelExpression>

<sectionHyperlink >

</sectionHyperlink>

</pieDataset>

<piePlot>

<plot backcolor="#CCCCFF" />

</piePlot>

</pieChart>

 

 

I also did try to use the Chart Customizer class. But I'm running into an issue where the first legend isn't modified, in my groups. The second and all subsequent legends do use the 8 font size.

Link to comment
Share on other sites

yes, my chart definition looks the same as yours. i've tried various font names, pdf font names, pdf encodings, but the chart title allways generates the same. in all combinations the title looks identically same!!! maybe its got nothing to do with jasperreports (1.2.8), maybe the problem is in jfreechart or itext. i've browsed thru the jfreechart forum and they advice to set:

"org.jfree.report.modules.output.pageable.pdf.Encoding" to "Identity-H" and

"org.jfree.report.modules.output.pageable.pdf.EmbedFonts" to "true"

but i dont know how to set it in jasper

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I suspect you came across a little bug introduced in JR 1.2.8. Fortunately is easy to fix and I suggest you try this:

 

Create a jasperreports.properties file and put it in the root of your application classpath (if you don't have such a file already).

Add the following property to this file:

 

net.sf.jasperreports.export.pdf.force.svg.shapes=true

 

Let me know if this solves anything.

 

Thank you,

Teodor

Link to comment
Share on other sites

  • 2 years later...

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...