使用自定义可视化组件 (CVC) 的 d3 与 Highchart Jasper 导出问题

d3 with Highchart Jasper Export Issue using Custom Visualization Component(CVC)

我正在开发一个分组堆叠条形图,请参考此 Fiddle,该图表正在 jasperserver 上呈现,但它没有导出为 PDF 和 Excel。我收到以下异常:

net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRRuntimeException: Error while executing the javascript file to generate the SVG image: External process did not end properly; exit value: 500; process output: TypeError: 'undefined' is not an object (evaluating 'HighchartsAdapter.addEvent') c:%5CJaspersoft%5Cjasperreports-server-6.0.1%5Capache-tomcat%5Ctemp%5Ccv_component_1432214735797_1720781342.html:25 c:%5CJaspersoft%5Cjasperreports-server-6.0.1%5Capache-tomcat%5Ctemp%5Ccv_component_1432214735797_1720781342.html:25 c:%5CJaspersoft%5Cjasperreports-server-6.0.1%5Capache-tomcat%5Ctemp%5Ccv_component_1432214735797_1720781342.html:25 c:%5CJaspersoft%5Cjasperreports-server-6.0.1%5Capache-tomcat%5Ctemp%5Ccv_component_1432214735797_1720781342.html:25 c:%5CJaspersoft%5Cjasperreports-server-6.0.1%5Capache-tomcat%5Ctemp%5Ccv_component_1432214735797_1720781342.html:67 SCRIPT_ERROR Script did not produce any SVG within 3 seconds. Possible script error.

这是我使用 (CVC) 组件在 Jasper Studio 上编写的脚本

define('d3Circle',['d3', 'highcharts'], function (d3) {
 return function (instanceData) {   
 var w = instanceData.width,
     h = instanceData.height;
 var margin = 20;
 var diameter = Math.min(w,h) - margin;
    var svg = jQuery("#" + instanceData.id).highcharts({ 
    chart: {
        type: 'column'
    },

    title: {
        text: 'Total fruit consumtion, grouped by gender'
    },

    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
    },
    yAxis: {
        allowDecimals: false,
        min: 0,
        title: {
            text: 'Number of fruits'
        }
    },
    tooltip: {
        formatter: function () {
            return '<b>' + this.x + '</b><br/>' +
                this.series.name + ': ' + this.y + '<br/>' +
                'Total: ' + this.point.stackTotal;
        }
    },
    plotOptions: {
        column: {
            stacking: 'normal'
        }
    },
    series: [{
        name: 'John',
        data: [5, 3, 4, 7, 2],
        stack: 'male'
    }, {
        name: 'Joe',
        data: [3, 4, 4, 2, 5],
        stack: 'male'
    }, {
        name: 'Jane',
        data: [2, 5, 6, 2, 1],
        stack: 'female'
    }, {
        name: 'Janet',
        data: [3, 0, 4, 4, 3],
        stack: 'female'
    }]
});
};

});

谢谢

我们必须 Phantom.js 配置 JasperServer 支持的所有导出。