Dynamic rectangles



I'd like to know if there is a way to make rectangles with dynamic size by parameter/field value, my scenario is a kind of a graph where each segment of a bar represent a percentage, and I hoped to use rectangles but I haven't found any way to set their sizes (or any solution that could help me to do anything similar):

klaytoncbrito's picture
Joined: Apr 2 2023 - 7:33pm
Last seen: 4 months 3 weeks ago

Thank you for posting to the Jaspersoft Community. Please let us know if you still require help with this question. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

mrajkuma - 4 months 3 weeks ago

1 Answer:

The short answer is no - the height/width properties of the rectangle element are static in the JRXML, they cannot change at report runtime. 

However, there are chart types that can generate something very similar, the immediate one that comes to mind is the stacked bar chart. The highcharts (premium) version can give you something very close to what you're trying to do. The free jasper version can generate the bar, but I'm not sure about the overlaying %s. Your options here are based on whether or not you have a Tibco license to use the premium chart types. 

darth_fader's picture
Joined: Mar 7 2010 - 9:45pm
Last seen: 3 hours 13 min ago