Jump to content
Changes to the Jaspersoft community edition download ×

Problem with Custom Visualization Component while export in pdf format


akthar.itzme

Recommended Posts

Hi ,

I am facing problem with Custom Visualization Component while exporting it in pdf format. Html format is working fine but pdf/java is not working.

I have checked the phantomjs path, It is set correctly and tested with command promp also.

I have also changed phantomjs version from 2.0 to 1.9.2. Still the problem exist.

Due to this issue i am not able to export my CVC reports. 

Kindly help regarding this. It is important. !!!

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

Thanks for your answer. I checked my server log i am getting the following error:

ERROR CVElementPhantomJSImageProvider,pool-15-thread-2:91 - Generating image for Custom Visualization element 1334138075 failed.
net.sf.jasperreports.engine.JRRuntimeException: Error while executing the javascript file to generate the SVG image: External process did not end properly; exit value: 1; process output:
--- Running highcharts.src.js from GitHub, branch/commit/tag "master" ---
SCRIPT_SUCCESS
 
Now after some times i get empty PDF reports.
 
HTML Output is working great always.
 
Kindly guide me in solving this. Urgent !!!
Link to comment
Share on other sites

My Javascript code is as follow :

define(['jquery_hc','hchart'], function ($, Highcharts) {
 
function getMonoChromeColors() {
 
var colors = [],
base = Highcharts.getOptions().colors[0],
i;
 
for (i = 0; i < 10; i += 1) {
// Start out with a darkened base color (negative brighten), and end
// up with a much brighter color
colors.push(Highcharts.Color(base).brighten((i - 3) / 7).get());
}
return colors;
}
 
return function (instanceData) {
 
/**
* Drop-in compatibility fix for semi-transparent strokes and fills for old WebKit 
* browsers as well as Batik export servers. The fix splits rgba fill colors into 
* solid colors for fills, and a separate fill-opacity attribute.
*/
Highcharts.SVGElement.prototype.fillSetter = Highcharts.SVGElement.prototype.strokeSetter = function (value, key, element) {
   var colorObject;
 
   if (typeof value === 'string') {
       if (value.indexOf('rgba') === 0) {
           // Split it up
           colorObject = Highcharts.Color(value);
           element.setAttribute(key + '-opacity', colorObject.get('a'));
           element.setAttribute(key, colorObject.get('rgb'));
       } else {
           element.removeAttribute(key + '-opacity');
           element.setAttribute(key, value);
       }
   } else {
       this.colorGradient(value, key, element);
   }
};
 
var data = [{"name" : "apple", "y" : 200}, {"name" : "Orange", "y" : 100}];
        var series0 = instanceData.series[0];
        // I have used dummy data already So, not going to use series0 data.
        var config = {
        chart: {
        renderTo: instanceData.id,
       backgroundColor: null,
                        borderWidth: 0,
                        margin: [2, 0, 2, 0],
       type: 'pie',
       width: instanceData.width,
                        height: instanceData.height,
                        style: {
                           overflow: 'visible'
                       },
                       skipClone: true
   },
   tooltip: {
    backgroundColor: null,
                        borderWidth: 0,
                        shadow: false,
                        useHTML: true,
                        hideDelay: 0,
                        shared: true,
                        padding: 0,
       pointFormat: '<b>{point.y} ({point.percentage:.1f}%)</b>'
   },
   plotOptions: {
       pie: {
           allowPointSelect: true,
           cursor: 'pointer',
           dataLabels: {
               enabled: true,
               format: '<b>{point.name}</b>: {point.percentage:.1f} %',
               style: {
                   color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
               }
           },
           colors: getMonoChromeColors()
       }
   },
   series: [{
       name: 'Brands',
       data: data
   }]
   };
   
new Highcharts.Chart(config);
};
});
Link to comment
Share on other sites

  • 5 years later...
  • 2 years later...

Did anyone find a resolution to this?  The issue is with jquery in the javascript.  My CVC uses jquery also. It seems as if the exporter does not know about jquery.  With additional log settings - this error is generated:

 ReferenceError: jQuery is not defined\n    at file:///tmp/jr_res_16848789916710125977_clusteredmap.min.js:63:9\n

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...