Jump to content
Changes to the Jaspersoft community edition download ×
  • Functions can be used to format html5 datalabels and tooltips


    ghudson_1
    • Features: Charts Version: v5.5, v5.1 Product: JasperReports® Server

    Issue Description:

    Html5 chart Tooltips values can be formatted using highchart's functions.  Following is an example of such tooltip formatting directly via javascript calls (unrelated to JasperReports Server): 

    http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/tooltip/formatter-simple/


    Resolution:

    Since JasperReports Server version 5.1, you can take advantage of these highcharts functions to impact things like tooltips as well as datalabels.

    First, add this line to WEB-INFclassesjasperreports.properties and restart the server:

    com.jaspersoft.jasperreports.highcharts.function.properties.allowed=true
    

    Then specify javascript function as strings within your expressions for advanced properties, like tooltip.formatter or plotOptions.pie.dataLabels.formatter. The resulting jrxml would be like: 

    <hc:chartProperty name="plotOptions.pie.dataLabels.formatter">
       <hc:propertyExpression>
          <![CDATA["function() {return '<b>something bold</b>: '+this.point.y;}"]]>
       </hc:propertyExpression>
    </hc:chartProperty>
    <hc:chartProperty name="tooltip.formatter">
       <hc:propertyExpression>
          <![CDATA["function() {return 'something with percent char: '+this.point.y+'%';}"]]>
       </hc:propertyExpression>
    </hc:chartProperty>
    

    label_formatter.jrxml attached using sugarcrm datasource.

    Note that JasperReports Server v5.5 contains a bug (35210 ) which effects the behavior of these functions.  The cumulative hotfix patch for JasperReports Server v5.5, available upon request from support, will resolve the bug (note that hotfixes are available for customers with Premiun Subscription only).


    Reference:


    Ref. Case #00034325

    label_formatter.jrxml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...