Sign in to follow this  
caloy

Batch Export - Fusionchartsexportcomponent.exportchart() Turns Out To Be Undefined

Recommended Posts

Hi I've been working on the batch exporting feature.

 

I have instantiated the FusionChartsExportComponent on a page with exportAction set to 'save', however when I run the batch export, I received an error id number 10902092036 which only says check export parameters.

 

When I checked on what and where the exception is thrown, I saw that the error is thrown by export component's batch export function. Code is breaking when exportChart() is checked because it seems to be undefined. see code below extracted from FusionChartsExportComponen.js:




_FCEO.batchExport = function (b, c) {
   if (!(c instanceof Array)) {
       b.trace(_FCEO.R.errArgs, 10902091853);
       return []
   }
   var d = [],
    	mRef = _FCEO.flags.c;
   _FCEO.flags.c += c.length;
   var e = parseInt(b.componentAttributes.strictTrigger || 0) == 0 ? function (a) {
       return a
   } : function (a) {
       a.handlerId = b.id;
       return a
   };
   for (var i = 0; i < c.length; i++) {
       var f = _FCEO.L.get(c[i]);
       if (f == null) {
           b.trace(_FCEO.R.errFusion, 10902092026);
           continue
       }
       if (!_FCEO.L.isObj(b.exportAttributes.exportParameters)) {
           b.exportAttributes.exportParameters = {}
       }

       b.exportAttributes.exportParameters.triggerOrdinal = mRef++;
       b.exportAttributes = e(b.exportAttributes);

/* Exception is thrown because exportChart turns out to be undefined. */
       if (f && f.exportChart) {
           f.exportChart(b.exportAttributes); d.push(f.id)
       } else {
           b.trace(_FCEO.R.errFusion + '\nRef: ' + f.id, 10902092036)
       }

   }
   return d
}; 


 

 

So my question is why exportChart() seems to be undefined? Is it because the component can't read or get the charts because of page's DOM structure or is it really a missing setting or attribute?

 

Weird part is, when I right click and save as jpeg, png or pdf, it works as expected. I have posted code on how the component was instantiated on the page and the xml attributes of the chart I am trying to export. Note though that I'll only post settings of one of the multiple charts in the page, meaning there are other charts contained in the charts as well.

 



//Initialize Batch Exporter with DOM Id as fcBatchExporter
       var myExportComponent = new FusionChartsExportObject("fcBatchExporter", "../../Charts/FCExporter.swf");

       myExportComponent.debugMode = true;

       //Add the charts to queue. The charts are referred to by their DOM Id.
       myExportComponent.sourceCharts = myExportComponent.sourceCharts = ['Executive_Summary_KPI_Funnel_Projects_and_Leads', 'Executive_Summary_KPI_Funnel_Site_Traffic'];

       // myExportComponent.exportAttributes.exportHandler = 'http://' + location.host + '/ExportHandlers/FCExporter.aspx';

       //------ Export Component Attributes ------//
       //Set the mode as full mode
       myExportComponent.componentAttributes.fullMode = '1';

       //Set saving mode as both. This allows users to download individual charts/ as well as download all charts as a single file.
       myExportComponent.exportAttributes.exportHandler = 'http://' + location.host + '/Handlers/FCExporter.aspx';
       myExportComponent.exportAttributes.exportEnabled = '1'
       myExportComponent.exportAttributes.exportAtClient = '0'
       myExportComponent.exportAttributes.exportAction = 'save'
       myExportComponent.exportAttributes.exportFilename = 'CarloChart3'
       // myExportComponent.componentAttributes.saveMode = 'both';

       //Show allowed export format drop-down
       myExportComponent.componentAttributes.showAllowedTypes = '1';
       //Cosmetics 
       //Width and height
       myExportComponent.componentAttributes.width = '350';
       myExportComponent.componentAttributes.height = '140';

       //Message - caption of export component
       myExportComponent.componentAttributes.showMessage = '1';
       myExportComponent.componentAttributes.message = 'Click on button above to begin export of charts. Then save from here.';

       // set save mode - options = inidividual or batch, if batch no option will be displayed for saving individual. individual or batch or both
       // myExportComponent.componentAttributes.saveMode = 'batch';
       myExportComponent.componentAttributes.saveMode = 'batch';

       // set default file name
       myExportComponent.componentAttributes.defaultExportFileName = 'MyCharts2011';

       // Similarly, if you want to specify a default export format (JPG, PNG or PDF), and hide the combo box (to select formats), you can set:
       myExportComponent.componentAttributes.defaultExportFormat = 'PNG';
       myExportComponent.componentAttributes.showAllowedTypes = '0';

       //Render the exporter SWF in our DIV fcexpDiv
       // myExportComponent.Render("fcexpDiv");         		

       $('#spnExport').bind('click', function () {
           myExportComponent.BeginExport();
           //displayExportProgressDialog();
           //exportPDF('contentDataContainer');
       });

 

 

the xml attributes of Executive_Summary_KPI_Funnel_Projects_and_Leads chart is below but I assume it will be values overriden when you specify attributes at the batch export component at the page:

 

exportEnabled='1'

exportHandler='../../Handlers/FCExporter.aspx'

exportAtClient='0'

exportAction='save'

 

anchorSides='3' anchorRadius='8' showValues='0' legendPosition='right' yAxisName='(000)' chartLeftMargin='25' chartTopMargin='10' exportEnabled='1' exportAtClient='0' exportAction='save' anchorSides='3' anchorRadius='8' showValues='0' legendPosition='right' yAxisName='(000)' chartLeftMargin='25' chartTopMargin='10' chartRightMargin='10'

 

 

 

 

Help please. :(

Edited by caloy

Share this post


Link to post
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
Sign in to follow this