Requirements: To apply/modify font changes like font-family/font-size/font-color in the Jasper high charts reports created using both the Jaspersoft studio and ad-hoc editor.
Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.
Prerequisites: Jasper server professional version, Jaspersoft studio professional.
-
Steps:
- Change the javascript optimize to false because we are modifying the script file. To check the changes applied immediately we have to use normal scripts. After completing the development we can optimize the scripts and change value to true.
- Open the highcharts-more.js file present in the location: (Jasper server)\apache-tomcat\webapps\jasperserver-pro\scripts\bower_components\highcharts-pack\highcharts
- In the above file inside the function, Highcharts create a new theme and set the theme to the high charts
- Save the file and run the report in jasper server. Now changes will be applied to the report
- To apply the same font changes in the exported high charts report, we have to modify the high charts jar file
- Open the jar file with WinRAR and go to folder:
- Take the js file “highcharts-more-4.2.1.src.js” to the system and add the above code
- Drag the same file into the jar file
- Now restart the jasper server
- Export the report into pdf and we can see the applied font changes
Value: javascript.optimize=false File to modified: js.config.properties Location: (Jasper server)\apache-tomcat\webapps\jasperserver-pro\WEB-INF
Function reference: (function (Highcharts) Theme: Highcharts.theme = { chart: { style: { fontFamily: 'Source Sans Pro' } }, xAxis: { labels: { style: { font: '12px Source Sans Pro !important' } } }, yAxis: { labels: { style: { font: '12px Source Sans Pro !important' } } } }; Highcharts.setOptions(Highcharts.theme);
In the above theme, we have added properties like font family on the entire chart, modifying the labels font size of both xAxis and yAxis.
Jar File: jasper reports-highcharts-7.1.0.jar Location: (Jasper server)\apache-tomcat\webapps\jasperserver-pro\WEB-INF\lib
jasperreports-highcharts-7.1.0.jar\com\jaspersoft\jasperreports\highcharts\charts\render\scripts
Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.
Before modifying default font properties in high charts:
After modifying default font properties in high charts:
Best Open Source Business Intelligence Software Helical Insight is Here
A Business Intelligence Framework
In case if you have any queries please get us at support@helicaltech.com
Thank You
Ramu Vudugula
Helical IT Solutions Pvt Ltd