Search code examples
highchartsjasper-reportsjaspersoft-studio

How to apply colorAxis.stops with heatmap in Jaspersoft Studio 6.0.1?


JasperReports Studio's heat-map chart is based on Highcharts, so I can use the Highcharts API to customize charts through the advanced properties dialog. But I can't figure out how to apply a non-linear color gradient to a heat-map chart.

What I have tried:

I went to Edit Chart Properties > Advanced Properties and added the property colorAxis.stops, which requires an array of tuples. But no matter what format I try to supply the array, I just end up with a broken chart.

e.g. java.util.Arrays.asList("{0, #ff0000}", "{0.5, #ffff00}", "{0.9, #00cc00}") displays a heat-map with no data.

How can I supply the array to this property so that I can get a non-linear gradient? (Red to Yellow to Green)


Solution

  • I solved my own problem. Write this as an expression in the colorAxis.stops property:

    java.util.Arrays.asList ( java.util.Arrays.asList(0, "#FF0000"), java.util.Arrays.asList(0.25, "#FF9900"), java.util.Arrays.asList(0.5, "#FFFF00"), java.util.Arrays.asList(1, "#00CC00") )

    Reference: http://community.jaspersoft.com/wiki/advanced-formatting-new-html5-charts