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

jmoss

Members
  • Posts

    2
  • Joined

  • Last visited

jmoss's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Brilliant: I knew it would be something simple like that. Thanks much!
  2. Hey everybody, I'm relatively new to iReport (& Jasper Reports in general), so I'm hoping this is just an issue of not fully understanding the platform. I'm trying to report on a set of questions, answers and counts for those answers. i.e. I'm trying to create a visual representation of the following (sample) SQL result: QuestionId AnswerId Total question 1 q1a1 14 question 1 q1a2 24 question 1 q1a3 4 question 2 q2a1 1 question 2 q2a2 12 question 3 q3a1 5 question 3 q3a2 3 question 3 q3a2 17 What I want to be able to do is create a 3D pie chart for each question, detailing a breakdown by answers. So, for the above result, I would have 3 pie charts: question 1 with 3 slices (q1a1, q1a2, q1a3), question 2 with 2 slices (q2a1, q2a2) and question 3 with 3 slices (q3a1, q3a2, q3a3). I've created a group, and am grouping on $F{QuestionID}. In that group's detail I've added a 3D pie chart. It resets on the question id group, and has an $F{AnswerId} Key Expression and a $F{Count} Value Expression. This seems to work (mostly) as intended: I get a charts with a breakdown by answer for each of those 3 groups. However, it looks like it's populating a new page for each of the rows in the result set, rather than 1 chart for each unique question. So, for the above data set, I get 8 pages of charts: 3 identical question 1 charts, 2 identical question 2 charts and 3 identical question 3 charts. Any suggestions on how to fix this problem? I've tried many combinations of options (like different increment types and group types, as well as chart options like printWhenGroupChanges), and nothing seems to do the trick. Below is a sample jrxml, and many thanks in advance for your help. Code:<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="QvA" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="732" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20"> <property name="ireport.scriptlethandling" value="2"/> <property name="ireport.encoding" value="UTF-8"/> <import value="net.sf.jasperreports.engine.*"/> <import value="java.util.*"/> <import value="net.sf.jasperreports.engine.data.*"/> <parameter name="SELECTOR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["some_selector"]]></defaultValueExpression> </parameter> <queryString> <![CDATA[sELECT QuestionId, AnswerId, COUNT(*) TotalFROM AnswerTableWHERE Selector = $P{SELECTOR}GROUP BY QuestionId, AnswerId]]> </queryString> <field name="QuestionId" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="AnswerId" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="Total" class="java.lang.Integer"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <group name="QuestionGroup"> <groupExpression><![CDATA[$F{QuestionId}]]></groupExpression> </group> <detail> <band height="490"> <pie3DChart> <chart evaluationTime="Group" evaluationGroup="QuestionGroup"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="732" height="490" printWhenGroupChanges="QuestionGroup"/> <chartTitle> <font size="14" isBold="true"/> <titleExpression><![CDATA[$F{QuestionId}]]></titleExpression> </chartTitle> <chartSubtitle/> <chartLegend position="Left"> <font size="14"/> </chartLegend> </chart> <pieDataset> <dataset resetType="Group" resetGroup="QuestionGroup"/> <keyExpression><![CDATA[$F{AnswerId}]]></keyExpression> <valueExpression><![CDATA[$F{Total}]]></valueExpression> </pieDataset> <pie3DPlot isCircular="true" labelFormat="{2}" legendLabelFormat="{0} - {2}"> <plot orientation="Horizontal"/> <itemLabel color="#000000" backgroundColor="#FFFFFF"> <font size="12"/> </itemLabel> </pie3DPlot> </pie3DChart> </band> </detail></jasperReport>
×
×
  • Create New...