How to use colorAxis.DataClasses property of Highcharts in JRXML

Currently I am doing like this
<hc:chartProperty name="colorAxis.dataClasses">
<hc:propertyExpression><![CDATA[java.util.Arrays.asList (

And then I am setting this property

<hc:chartProperty name="colors">
                                             "#FFFFFF", "#4A90E2","#6FA7E8","#93BDEE",
and then 
<hc:chartProperty name="colorAxis.dataClassColor">
So that it takes the color which I have defined. The error I am getting is that,
  1. The legend does not displays like >0, 0-20 and so on as shown in the following fiddle
  2. I am justting getting colors followed by <
  3. The heat map picks up only the last color no matter what data is there in the cell.

I have already used color stops but we have specific requirement of dataclasses.

Please let me know how to use them in JRXML

I am using Jaspersoft Studio version 6


skatariya's picture
Joined: Feb 11 2015 - 12:38pm
Last seen: 1 year 4 months ago

1 Answer:


Use the Function Return to send multiple parameters into an expected JSON for highcharts. The list array is fine with only a single parameter with multiple values, but here you need multiple parameters answered:


<hc:chartProperty name="colorAxis.dataClasses">
<hc:propertyExpression><![CDATA["function(){return [{to: 0, color: '#FFFFFF', name: 'Missing Data'},{from: 0, to: 20, color: '#4A90E2', name: 'From 0 to 20%'},{from: 20, to: 40, color: '#6FA7E8', name: 'From 20% to 40%'},{from: 40, to: 60, color: '#93BDEE', name: 'From 40% to 60%'},{from: 60, to: 90, color: '#B7D3F4', name: 'From 60% to 90%'},{from: 90, color: '#DBE9FA', name: 'From 90% to 100%'}]}()"]]></hc:propertyExpression>
craig.linderoth's picture
Joined: Jan 14 2015 - 5:27am
Last seen: 4 years 4 months ago