Search code examples
highchartsjasper-reportsjfreechart

Trying to provide a list of symbols (per series) for Highcharts line graph in iReport


I have an html5 (highcharts) line chart in Jasper reports. Currently it seems like the symbols used to mark the line for each series are chosen for a fixed list, then cycled. I'd like to set the symbol for series 1, series 2... explicitly in the same way as you can for colors

e.g. colors java.util.Arrays.asList("#4572A7","#4572A7","#AA4643","#AA4643","#89A54E","#89A54E","#80699B","#80699B")

I'm aware that you can hardcode the symbol for all lines using plotOptions.line.marker.symbol.

I'm also aware of options.symbols mentioned in the api http://api.highcharts.com/highcharts#series.data.marker but I don't know how to write to this from Jasper or if this is possible.


Solution

  • I found a way to do this with help from Jasper support. You'd have to create a field in the query to return the correct marker for each series "circle", "square", "diamond", "triangle" and "triangle-down" etc.

    Then you can add a bucket property against the series with the value of the field returned.

    Then in the measure create an advanced property

    Built-in Series Property Contributor
    marker.symbol
    

    refer it to the bucket property value from the series e.g.

    seriesName.MarkerSymbol

    This will contain the correct symbol for each series as I originally requested