Tip : formatter function example for high chart advanced properties

Sadakar Pochampalli
JasperSoft BI Suite Tutorials - Sadakar Pochampalli )

Visualization :  Column / Vertical bar chart
Problem statement : How to write highcharts function in Jasperreport expression ?
                                  Add a $ sign to Y axis labels 
Navigation : YAxis > labels > formatter > Select for expression 

NOTE : Ensure to add the below property in jasperreports.properties file
com.jaspersoft.jasperreports.highcharts.function.properties.allowed=true

Path : C:\Jaspersoft\jasperreports-server-7.5.0\apache-tomcat\webapps\jasperserver-pro\WEB-INF\classes


Sample screenshot: 


Sample output: 


References: 
JRXML (works on 7.2 studio professional)
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 7.2.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Stop Loss Plan Performance" pageWidth="620" pageHeight="470" whenNoDataType="AllSectionsNoDetail" columnWidth="620" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="f5ee6cd9-fdbd-4655-a337-ef2568c81a56">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<property name="ireport.jasperserver.url" value="http://localhost:8080/jasperserver-pro/"/>
<property name="ireport.jasperserver.user" value="superuser"/>
<property name="ireport.jasperserver.report.resource" value="/LOCKTON_2020_21/S8_Stop_Loss_Plan_Performance_files/main_jrxml"/>
<property name="ireport.jasperserver.reportUnit" value="/LOCKTON_2020_21/S8_Stop_Loss_Plan_Performance"/>
<property name="com.jaspersoft.studio.report.unit.description" value="001_RP_Stop Loss Marketing Analysis"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<property name="com.jaspersoft.jasperreports.highcharts.interactive" value="false"/>
<subDataset name="Dataset1-Claims Vs Premium" uuid="ba6bd55c-4dcd-431c-aa4b-587d99dd0b60">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="foodmart"/>
<queryString language="SQL">
<![CDATA[SELECT '2018' AS year, 400000 AS value, 'Premium' AS PremiumClaim
UNION ALL
SELECT '2018' AS year, 850000 AS value, 'Claim' AS PremiumClaim
UNION ALL
SELECT '2019' AS year, 450000 AS value, 'Premium' AS PremiumClaim
UNION ALL
SELECT '2019' AS year, 60000 AS value, 'Claim' AS PremiumClaim
UNION ALL
SELECT '2020' AS year, 210000 AS value, 'Premium' AS PremiumClaim
UNION ALL
SELECT '2020' AS year, 5000 AS value, 'Claim' AS PremiumClaim]]>
</queryString>
<field name="year" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="year"/>
</field>
<field name="value" class="java.lang.Integer">
<property name="com.jaspersoft.studio.field.label" value="value"/>
</field>
<field name="premiumclaim" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="premiumclaim"/>
</field>
</subDataset>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<summary>
<band height="460" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<image>
<reportElement x="0" y="70" width="330" height="4" uuid="6c9ee3ac-3d60-4c0e-a2d3-8d09a4777b01">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<printWhenExpression><![CDATA[1==0]]></printWhenExpression>
</reportElement>
<imageExpression><![CDATA["repo:/Test/Images/test/horizontal_heading_bar.png"]]></imageExpression>
</image>
<textField>
<reportElement x="50" y="25" width="530" height="40" uuid="c43bf219-e07c-4286-afcd-c8136a487828"/>
<textElement verticalAlignment="Bottom">
<font fontName="Garamond" size="30"/>
</textElement>
<textFieldExpression><![CDATA["Test"]]></textFieldExpression>
</textField>
<componentElement>
<reportElement x="70" y="120" width="550" height="280" uuid="fc2b6ea6-7033-4af9-aa74-9efda7096ec8"/>
<hc:chart xmlns:hc="http://jaspersoft.com/highcharts" xsi:schemaLocation="http://jaspersoft.com/highcharts http://jaspersoft.com/schema/highcharts.xsd" type="Column">
<hc:chartSetting name="default">
<hc:chartProperty name="title.text" value=""/>
<hc:chartProperty name="credits.enabled" value="false"/>
<hc:chartProperty name="credits.href" value=""/>
<hc:chartProperty name="credits.text" value=""/>
<hc:chartProperty name="yAxis.title.text" value=""/>
<hc:chartProperty name="chart.zoomType" value="xy"/>
<hc:chartProperty name="legend.itemStyle.fontSize" value="8px"/>
<hc:chartProperty name="yAxis.labels.formatter">
<hc:propertyExpression><![CDATA["function() {return '$' + this.axis.defaultLabelFormatter.call(this);}"]]></hc:propertyExpression>
</hc:chartProperty>
<hc:chartProperty name="yAxis.tickInterval_customSimpleMode" value="true"/>
<hc:chartProperty name="yAxis.tickInterval">
<hc:propertyExpression><![CDATA[200000]]></hc:propertyExpression>
</hc:chartProperty>
</hc:chartSetting>
<multiAxisData>
<multiAxisDataset>
<dataset>
<datasetRun subDataset="Dataset1-Claims Vs Premium" uuid="e9b1c867-29a5-4cd7-abd7-76b0d846367f"/>
</dataset>
</multiAxisDataset>
<dataAxis axis="Rows">
<axisLevel name="Level1">
<labelExpression><![CDATA["Level Label expression"]]></labelExpression>
<axisLevelBucket order="None" class="java.lang.Comparable">
<bucketExpression><![CDATA[$F{year}]]></bucketExpression>
</axisLevelBucket>
</axisLevel>
</dataAxis>
<dataAxis axis="Columns">
<axisLevel name="Series1">
<labelExpression><![CDATA[]]></labelExpression>
<axisLevelBucket order="None" class="java.lang.Comparable">
<bucketExpression><![CDATA[$F{premiumclaim}]]></bucketExpression>
</axisLevelBucket>
</axisLevel>
</dataAxis>
<multiAxisMeasure name="Measure1" class="java.lang.Number" calculation="Nothing">
<labelExpression><![CDATA["Value:"]]></labelExpression>
<valueExpression><![CDATA[$F{value}]]></valueExpression>
</multiAxisMeasure>
</multiAxisData>
<hc:series name="Measure1"/>
</hc:chart>
</componentElement>
</band>
</summary>
</jasperReport>
Feedback