Reputation: 2075
There is very simple question, but I can't found the desicion exactly for jrxml-code.
I have the BarChart with labels of bars and these label must be formatted as percent format not via Java, and in jrxml-code
like this
<itemLabel color="#000000" backgroundColor="#FFFFFF"/>
I suspect that in this tag should be some attribute, that makes it possible.
Thanks a lot!
Upvotes: 0
Views: 3347
Reputation: 1812
With the tags for the bar chart, where you found the itemlabel tag, put this:
<valueAxisFormat>
<axisFormat tickLabelMask="0.0%" verticalTickLabels="false" />
</valueAxisFormat>
If you are using the iReports designer, you can just add 0.0% to "Value Axis Tick Label Mask" in the properties panel/window after clicking on the bar chart.
Note: that you may need to modify your data, as a value of 5 will be formatted to 500.0%.
Of course you can use different masks #%, 0.00%, #0.0%
Unrelated, but you can expand the axisFormat tag and change the label font if desired by modifying to:
<axisFormat tickLabelMask="0.0%" verticalTickLabels="false">
<labelFont>
<font fontName="Arial" size="10"/>
</labelFont>
</axisFormat>
If this option does not work, the work around would be to add a column where your values are stored for percent labels. You can use the "Value Axis Label Expression" to query for the labels.
Upvotes: 2