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

时间:2015-05-21 13:40:35

标签: javascript d3.js highcharts jasper-reports jasperserver

我正在开发一个分组堆积条形图,请参阅此Fiddle,该图表在jasperserver上呈现,但它不会导出为PDF和Excel。我接受了以下异常:

  

net.sf.jasperreports.engine.JRRuntimeException:net.sf.jasperreports.engine.JRRuntimeException:执行javascript文件生成SVG图像时出错:外部进程没有正确结束;退出值:500;进程输出:TypeError:'undefined'不是对象(评估'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脚本在3秒内未生成任何SVG 。可能的脚本错误。

这是我使用(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'
    }]
});
};

});

谢谢

1 个答案:

答案 0 :(得分:0)

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