TheBronx Posted June 20, 2013 Share Posted June 20, 2013 I have a variable of type List (ArrayList in fact) that contains numbers. How can I plot that numbers in a Bar Chart? What should I enter in Series Category Expression?Complete story:I'm using an XML datasource. One of its fields is:<values>48,59,59,58,53,53,52,55,50,52,54,56,57,59,60,57,56,55,58,62</values>[/code]So I've created a variable with those values splitted like this:<variable name="arraylist" class="java.util.List"><variableExpression><![CDATA[newArrayList<>(Arrays.asList($F{values}.split(",")))]]></variableExpression></variable>[/code]Now I want to plot the values in a Bar Chart but... what should I write here?http://i.stack.imgur.com/HnZuL.pngThe list of values will always have 20 values (size=20), if that simplifies the problem. Link to comment Share on other sites More sharing options...
lucianc Posted June 21, 2013 Share Posted June 21, 2013 You could create a subdataset that has a field called _THIS, use the subdataset for the chart with new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($V{arraylist}), and set $F{_THIS} as category and value expressions.HTH,Lucian Link to comment Share on other sites More sharing options...
ruchiagraw Posted October 9, 2014 Share Posted October 9, 2014 DId it work for yu ? if so can u please share ur jrxml here as I am stuck in same kind of scenario Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now