Jump to content
We've recently updated our Privacy Statement, available here ×
  • Tips-n-Tricks for boosting bar charts rendering time in JRXML reports


    prusyn
    • Features: Reports Version: v7.3, v7.2, v7.2.1, v7.1 Product: JasperReports® Library

    Use case:

    [toc on_off::hide=1]

    Customer has a few reports that utilize the detail band to iterate through 60-100 records and display a high chart (a simple one bar "gauge" type chart). They have noticed that the performance of the highcharts rendering really slows down the report. The data comes back within a few seconds, but then the report has to "wait" until each high chart renders. Result report contains about 100 bar charts in a single page:

    download_21.png.c6c5dd4787f586ee957a74920c19127d.png


    Issue:

    It appears, charts (especially in every page) significantly increase report execution time. Also, render time depends a lot of its appearance ( how customized is it). Also, it is not always the best practice to place charts in detail band of the report. Unless that's what are your requirements.


    Resolution:

    Important note: This resolution can fully be applicable only to this usecase. For other types of charts or usecases, this article can be considered as a list of possible suggestions of how to improve charts rendering time.

    First - Given that the charts are just a simple bar charts, one option would be to give up using Highcharts and write some code that creates SVGs or PNGs for the charts. Or you can even write the SVG directly in the image expression. I shall attach "image_sample" report, as an example. But it appears, it's not especially pretty.

    Second - If you need to stick to Highcharts, there might be a few changes that would slightly improve the time it takes to render the charts. For instance you can set the com.jaspersoft.jasperreports.highcharts.interactive property to false (at chart element level) to disable the interactive chart type change action. And maybe, depending on the chart type, some chart properties can be tweaked to reduce the work done by Highcharts. 

    Regarding this,  it seems that setting the com.jaspersoft.jasperreports.highcharts.interactive to false for the element, and setting the xAxis.labels.enabled and yAxis.labels.enabled chart properties to false resulted in a noticeable performance improvement (on Chrome at least). Also, attaching the "chart_sample" report that I tested.

    Other changes in the way the charts are rendered would involve modifying the JR/S JavaScript code. A cleanup might also help to some degree, the chart seems to have several properties that are useless (e.g. plotOptions.pie.showInLegend).

    download_21.png.edcc0447658b5bc800d80e0ab7116308.png

    chart_sample.jrxml

    image_sample.jrxml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...