jsutherland_1 Posted August 10, 2017 Share Posted August 10, 2017 Wow, you'd think it would be easier to get % or data labels in the pie slices! Unless I'm missing something, you have to have a function as a custom property. I've tried it, yet it won't display the % in the HTML5 pie slices. Here's the code in the jrxml file: <hc:chartProperty name="plotOptions.pie.dataLabels.formatter"> <hc:propertyExpression><![CDATA["function() {return Math.round(this.percentage*100)/100 + ' %';}"]]></hc:propertyExpression></hc:chartProperty>[/code]I've also got <property name="com.jaspersoft.jasperreports.highcharts.function.properties.allowed" value="true"/>but at the local level in JasperStudio 6.4 not sure that is relevant.The pie chart is showing in Studio, just not with the %. Anybody know what I'm missing? Link to comment Share on other sites More sharing options...
babasss Posted August 11, 2017 Share Posted August 11, 2017 On a dashlet (on a dashboard), I use series.dataLabels.format => {point.name} : {point.percentage:.1f}%Maybe, it can help you ! Link to comment Share on other sites More sharing options...
jsutherland_1 Posted August 11, 2017 Author Share Posted August 11, 2017 The answer below does help, and I appreciate the response. Using the .format option with:<hc:chartProperty name="plotOptions.series.dataLabels.format" value="{point.name} {point.percentage:.0f} %;"/>It does show the name and % as part of the data label. My intent/hope though is to keep the data label as the name only and put the % in the pie slice itself. Has anybody successfully done that? Link to comment Share on other sites More sharing options...
jsutherland_1 Posted August 11, 2017 Author Share Posted August 11, 2017 I've just about got the effect I want by adding:<hc:chartProperty name="plotOptions.pie.dataLabels.distance" value="-50"/>This puts the name and % together, and builds the label into the chart, maximizing the available chart space. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now