Sign in to follow this  
fusion_freak_

Linked Charts Batch Export Help

Recommended Posts

I have several charts in my application page, where few charts are linked charts.

Batch export works fine for these charts, but once i get the linked charts and try to batch export i get error in script.

 

for (var i = 0; i < chartcount; i++) {

           	chartObject1 = getChartFromId('BackLog' + i);
           	if (chartObject1 != null) {
               	if (chartObject1.hasRendered())                            	//error occurs here when linked charts are viewed and tried for export
                   	chartObject1.exportChart();
               	totalCharts++;
           	}
       	}

 

It would be helpful if a sample code snippet is given to show, how to batch export when linked charts are used.

 

I have another doubt, what will be the chart id of linked chart, is it the parent chart id or should we specify it?

Share this post


Link to post
Share on other sites

Hi,

 

In case you need to export all the visible charts present in a page irrespective of whether they are linked-child charts or not, you can achieve this using the following code:

 

for (var chartItem in FusionCharts.items) {
   if (FusionCharts.items[chartItem] && FusionCharts.items[chartItem].isActive() && FusionCharts.items[chartItem].exportChart) {
      FusionCharts.items[chartItem].exportChart();
   }
}

NOTE:

 

  1. FusionCharts.items returns an Object containing the reference of all the charts (visible or invisible) present in the page. The keys of this object contains the chart IDs.
  2. The if expression evaluator first checks whether any object related to that chartID exists
  3. Next it checks whether the chart is rendered and visible through - isActive() as it returns false when a chart is hidden.
  4. Next it checks if exportChart function is available.

 

IMPORTANT: Each of the charts that you want to export must be configured through XML/JSON to enable export (using exportEnabled, exportHandler and exportAtClient attributes).

Share this post


Link to post
Share on other sites

Thank you Sudipto Choudhury for your immediate response. This is what i actually wanted.

 

Hi,

 

In case you need to export all the visible charts present in a page irrespective of whether they are linked-child charts or not, you can achieve this using the following code:

 

for (var chartItem in FusionCharts.items) {
   if (FusionCharts.items[chartItem] && FusionCharts.items[chartItem].isActive() && FusionCharts.items[chartItem].exportChart) {
  	FusionCharts.items[chartItem].exportChart();
   }
}

NOTE:

 

  1. FusionCharts.items returns an Object containing the reference of all the charts (visible or invisible) present in the page. The keys of this object contains the chart IDs.
  2. The if expression evaluator first checks whether any object related to that chartID exists
  3. Next it checks whether the chart is rendered and visible through - isActive() as it returns false when a chart is hidden.
  4. Next it checks if exportChart function is available.

 

IMPORTANT: Each of the charts that you want to export must be configured through XML/JSON to enable export (using exportEnabled, exportHandler and exportAtClient attributes).

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