AdHoc Pie Chart Adding Datalabels (AWS)

0

Hello,

using Jasperserver 5.6 on AWS.

I am trying to add DataLabels to the Piecharts in Ad-Hoc Editor
For this I changed scripts/adhoc/highchart.datamapper.js as following

 

var result = _.extend(HDM.getGeneralOptions(extraOptions), {
                xAxis: {
                    categories: []
                },
                plotOptions: {
                    pie: {
                        slicedOffset: 0,
                    <span style="background-color:#ffff00;">    dataLabels: { enabled: true },</span>
                        point: {
                            events: {
                                legendItemClick: HDM._getLegendItemClickHandler
                            }
                        }
                    }
                },
                series: [],
                labels: {
                    items: []
                }
            });

I uploaded the file and restarted tomcat7. but there is no effect in the charts.

Any idea?
Thanks a lot,

Philipp

stegmann's picture
Joined: Jul 18 2013 - 6:50am
Last seen: 3 years 8 months ago

var result = _.extend(HDM.getGeneralOptions(extraOptions), {
                xAxis: {
                    categories: []
                },
                plotOptions: {
                    pie: {
                        slicedOffset: 0,
                        dataLabels: { enabled: true },
                        point: {
                            events: {
                                legendItemClick: HDM._getLegendItemClickHandler
                            }
                        }
                    }
                },
                series: [],
                labels: {
                    items: []
                }
            });

stegmann - 4 years 9 months ago

1 Answer:

0

Starting with version 6.2 you can use advanced properties to apply labels to pie charts. You need to use "series.dataLabels.enabled" and set it to true. You can also use "series.dataLabels.distance" to control positioning of the data labels.

Note that you need to use series.dataLabels... rather than plotOptions.pie.dataLabels... to apply properties to adhoc pie charts. You may try to use these properties in your dataMapper.js change.  Also, if you use optimized version of scripts, you need either to add _opt=false parameter to the URL or re-compile optimized scripts after the changes as described in the doc:

http://community.jaspersoft.com/documentation/jasperreports-server-ultimate-guide/v561/customizing-javascript-files

sanderse's picture
Joined: Jul 31 2017 - 3:51pm
Last seen: 3 hours 3 min ago
Feedback
randomness