HTML5 Chart - Problem displaying data

0

Hello there,

I'm having a problem displaying a small table as a bar chart using the HTML5 Pro tool in Jaspersoft Studio Pro 6.2.0.

Here is what my SQL output looks like:

SQL

In Jaspersoft I'm ending up with two charts, with both 2018 and 2018 figures added together (Essentially a duplicated chart). 

My chart configuration looks like this:

chart

I've already checked the following: 

The report is located in the details band, the evaluation time is set to "Report", The "Reset Type" is set to "Report" under the Dataset tab, and I can't set a "Increment Type" because there are no groups. 

The chart (after adding it to the summary band) looks like this:

I'm trying to group the months from 18/17 side by side.

Please help? :c

 

justin.brown11's picture
Joined: Apr 5 2017 - 6:16am
Last seen: 8 months 4 weeks ago

Hi prusyn,

I've added the chart into the summary band and you are indeed correct, Now I'm only seeing one chart. The issue now is that both the 2018 and the 2017 results are added together as if the chart isn't grouping on the year. What am i doing wrong? :( 

Here is what the "Year" category looks like:

justin.brown11 - 8 months 2 weeks ago

If i understood you correctly, this is something you want to acheive: http://prntscr.com/lllkox

If so, I have attached sample report to my original answer. I hope this helps.

prusyn - 9 months 5 days ago

2 Answers:

1

As I understand the problem is you see two charts, while you should be seeing only one. In this case the problem is that you put the chart in detail band. Everything present in detail band is printed as many times as there are rows in dataset. If you had 100 rows in dataset, you'd end up with 1000 charts :)

Another issue you might experience would be Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error incrementing bidimensional dataset.

What I would suggest - place Chart into Summary band.

Attachments: 
AttachmentSize
Binary Data mainreport.jrxml4.33 KB
prusyn's picture
348
Joined: Feb 22 2018 - 3:49am
Last seen: 1 day 12 hours ago
0

I've managed to work this out myself (Thanks for the tip about the summary).

My workaround for this appears to work for only bar charts (but nonetheless). What I've done is alter my SQL output slightly to output everything to one line, in my dataset I've only dealing with two specified years ($P{YEAR} and $P{YEAR}-1).

The ordering of the bars as mentioned below appears to order the fields from left to right meaning I can use field names such as Jan-18 and Jan-17 in order to correct the ordering. 

However, because the years are user-specified I've simply used the label expression: "Jan-" + $F{CURR} and "Jan-" + $F{PREV}.

The drawbacks are:

  • I've had to add each month twice
  • This only appears to work for bar-chart type charts. 

 

 

 

 

 

justin.brown11's picture
Joined: Apr 5 2017 - 6:16am
Last seen: 8 months 4 weeks ago
Feedback