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

dafr

Members
  • Posts

    4
  • Joined

  • Last visited

dafr'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. Why not use the simple expression: $F{FIELD1}+$F{FIELD2} within the same text field?
  2. Previous suggested solution works! It is enough to simply add the two booleans to the constructor of the XYSeries to allow duplicate domain values and prevent sorting of the data items in function of the domain value. The change is made on line 146 in JRFillXyDataset of jasperreports. Change this: xySrs = new XYSeries(seriesName); to this: xySrs = new XYSeries(seriesName, false, true); Compile, make the JAR, and use the new jasperreports jar in iReport and you will be able to draw polygones with a scatter plot like the blue line in attached image of the first post. Even nicer would be that these two boolean properties would be exported to the scatter plot properties in iReport but I will leave this to the development team of iReport and jasperreports to decide.
  3. I think I found the culprit: The scatter chart (like many other charts) uses XYSeries to create the data series in the dataset. If not explicitly set in the constructor of the XYSeries, the autosort property is enabled by default, causing all data items to be sorted in function of domain value. Even when implementing your own JRChartCustomizer, you cannot do anything about this as the data is already sorted and the original order of the data is already lost when you enter the customize method. The only way I see to fix this is to alter the code of iReport/JasperReports where the XYSeries are created and set the autosort flag to false. While you are at it, you may also want to set the flag to permit duplicate domain values. These are two properties that would be very usefull in the iReport properties of the scatter chart. I will try to do this fix today and will update this thread.
  4. I am trying to use the scatter chart to display polygones but am facing the following problem: The data order of xySeries in a scatter chart seem to be defined by ascending domain value in stead of the order in which the records are provided to the JFreeChart. This results in a connecting line that connects the data points in ascending domain value rather than in the order in which they are provided. If you take a look at the attached image (a screenshot of the generated PDF report), you 'll see that the red line (which is the actual generated graph) is like a zig-zag line while the transparent thick blue line is what it is supposed to be. Note that the blue line is not part of the graph, this is drawn on top of the screenshot for illustration purpose. I am using an XML datasource like this: <datamodel name="scatter test"> <series name="scatter test series"> <data key="a" x="1.0" y="1.0"/> <data key="b" x="3.0" y="1.0"/> <data key="c" x="4.0" y="2.0"/> <data key="d" x="2.0" y="2.0"/> <data key="e" x="1.0" y="1.0"/> </series> </datamodel> The graph that I expect should be the polygone a-b-c-d-e but I get a-e-d-b-c.The XML part of the chart looks like this: <scatterChart> <chart> <reportElement mode="Opaque" x="0" y="0" width="275" height="249"/> <chartTitle> <titleExpression><![CDATA["SCATTER CHART TEST"]]></titleExpression> </chartTitle> <chartSubtitle/> <chartLegend> <font size="8"/> </chartLegend> </chart> <xyDataset> <dataset> <datasetRun subDataset="scatter test"> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("/datamodel[@name=\"scatter test\"]/series/data")]]></dataSourceExpression> </datasetRun> </dataset> <xySeries> <seriesExpression><![CDATA[$F{name}]]></seriesExpression> <xValueExpression><![CDATA[new Double($F{x})]]></xValueExpression> <yValueExpression><![CDATA[new Double($F{y})]]></yValueExpression> </xySeries> </xyDataset> <scatterPlot isShowShapes="false"> <plot/> <xAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </xAxisFormat> <yAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </yAxisFormat> </scatterPlot></scatterChart> I already tried all types of charts and even added a sorting order in the subdataset itself without any luck. Is there a way to solve this so the resulting graph is like the blue line in the attached image?Thanks in advance,Daniel
×
×
  • Create New...