How to use colorAxis.DataClasses property of Highcharts in JRXML

0
Currently I am doing like this
<hc:chartProperty name="colorAxis.dataClasses">
<hc:propertyExpression><![CDATA[java.util.Arrays.asList (
java.util.Arrays.asList(0),
                     java.util.Arrays.asList(0,20),
                    java.util.Arrays.asList(20,40),
                    java.util.Arrays.asList(40,60),
                    java.util.Arrays.asList(60,80),
                    java.util.Arrays.asList(80,100)
)]]></hc:propertyExpression>
</hc:chartProperty>

And then I am setting this property

<hc:chartProperty name="colors">
<hc:propertyExpression><![CDATA[java.util.Arrays.asList(
                                             "#FFFFFF", "#4A90E2","#6FA7E8","#93BDEE",
                            "#B7D3F4","#DBE9FA")]]></hc:propertyExpression>
</hc:chartProperty>
and then 
 
 
<hc:chartProperty name="colorAxis.dataClassColor">
<hc:propertyExpression><![CDATA["category"]]></hc:propertyExpression>
</hc:chartProperty>
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  http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.co...
  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:

0

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>
</hc:chartProperty>
 
craig.linderoth's picture
Joined: Jan 14 2015 - 5:27am
Last seen: 4 years 4 months ago
Feedback
randomness