How to let user change measure in HTML5 bar chart?

I have a report were I need a bar chart to display some hourly sales data.
The report have have some input controls so that the user can filter the dataset, e.g see data for a specific period. The user should also be able to decide which measures he want to see in the bar chart, being for instance sales amont per hour or number of sales per hour.
I was thinking I could use an input control for which measure to display. So when designing the bar chart I tried to add a measure that has the value expression $F{$P{MeasureType}} where MeasureType is my input control (a list with  same values as the fields from the dataset in the report), but I get that this is not a valid expression. Is there a way the user could decide which measure to see?
I was also thinking that perhaps I could add one measure for sales amount, one for number of sales and so on (16 in total) and hide all except one of the group members. So in the example under I would like only the red columns (First) to be visible, but the user could click on the Second and Third labels to see these columns. Is that possible? It seems like all measures are visible in the chart by default.
I am using JasperSoft Studio professional. Tried HTML5 chart.
ebz's picture
Joined: Jan 7 2016 - 3:14am
Last seen: 2 years 11 months ago

1 Answer:


You can not use sth like "$F{$P{MeasureType}}".

For example, the expression should be sth like:

$P{MeasureType} == 0 ? $F{s_amount} : $F{s_number}

zh3ntil's picture
Joined: Nov 19 2014 - 11:02pm
Last seen: 4 years 3 weeks ago