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

ishanisamaraweera

Members
  • Posts

    2
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by ishanisamaraweera

  1. How can change width, height dynamically in Jasper using parameters? <image onErrorType="Icon"> <reportElement mode="Opaque" x="0" y="0" width="166" height="67" uuid="c3c0a660-62ed-4a17-8bb7-c8ed91a87b98"> <propertyExpression name="width"><![CDATA[$P{logoWidth}]]></propertyExpression> <propertyExpression name="height"><![CDATA[$P{headerHeight}]]></propertyExpression> </reportElement> <imageExpression><![CDATA[$P{imageurl}]]></imageExpression> I tried with above code block but it didn't override initial values with the parameter values.
  2. I have added a jar file to add a chart customizer class in my jasper report. But when compiling it gives the NoSuchMethodError. I have added enough libraries to the classpath and I am using jasperreports-6.5.1 and jfreechart-1.5.0. Jasper exception: java.lang.NoSuchMethodError: org.jfree.chart.title.LegendTitle.setItemLabelPadding(Lorg/jfree/chart/ui/RectangleInsets;)V null java.lang.NoSuchMethodError: org.jfree.chart.title.LegendTitle.setItemLabelPadding(Lorg/jfree/chart/ui/RectangleInsets;)V Source code in the jar file: public class ChartCustomizer extends JRAbstractChartCustomizer {DecimalFormat twoPlaces = new DecimalFormat("0.00");@Overridepublic void customize(JFreeChart jFreeChart, JRChart jrChart) { if (jFreeChart.getPlot().getClass().equals(PiePlot3D.class)) { formatPiePlot3D((PiePlot3D) jFreeChart.getPlot()); } else if (jFreeChart.getPlot().getClass().equals(PiePlot.class)) { formatPiePlot((PiePlot) jFreeChart.getPlot()); } LegendTitle legend = jFreeChart.getLegend(); legend.setItemLabelPadding(new RectangleInsets(2, 2, 2, 999999999));}private void formatPiePlot3D(PiePlot3D plot) { PieSectionLabelGenerator labelGenerator = new StandardPieSectionLabelGenerator("{2}", new DecimalFormat("0"), new DecimalFormat("0.00%")); PieSectionLabelGenerator legendGenerator = new StandardPieSectionLabelGenerator("{0} - {1}", new DecimalFormat("#,##0.00", new DecimalFormatSymbols(new Locale("en_US"))), new DecimalFormat("0%")); plot.setLegendLabelGenerator(legendGenerator); plot.setLabelGenerator(labelGenerator);}private void formatPiePlot(PiePlot plot) { PieSectionLabelGenerator labelGenerator = new StandardPieSectionLabelGenerator("{2}", new DecimalFormat("0"), new DecimalFormat("0.00%")); PieSectionLabelGenerator legendGenerator = new StandardPieSectionLabelGenerator("{0} - {1}", new DecimalFormat("#,##0.00", new DecimalFormatSymbols(new Locale("en_US"))), new DecimalFormat("0%")); plot.setLegendLabelGenerator(legendGenerator); plot.setLabelGenerator(labelGenerator);} }[/code]Libraries imported to the jar file source and classpath: jcommon-1.0.24 jfreechart-1.5.0 jasperreports-6.5.1 jfreesvg-3.3
×
×
  • Create New...