Sign in to follow this  
Rahul Kumar

Print function is not working

Recommended Posts

Hi,

 

 

 

I want to print the chart when the print icon is clicked so I am calling the js function.

 

function printChart(divId){

 

//Get chart from its ID

 

var chartToPrint = getChartFromId(divId);

 

chartToPrint.print();

 

}

 

 

 

I am passing the chart id which is unique id and set the registerWithJS=1

 

 

 

here is the view source of my chart:

 

 

 

 

 

width="450" height="300" id="chart_1">

 

 

 

 

 

 

quality="high" width="450"

 

height="300" name="chart_1"

 

allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

 

 

 

 

 

 

I am using FusionCharts_Evaluation licence copy, please help asap .. its very urgent.

 

Thanks in advance

Share this post


Link to post
Share on other sites

when calling script function the following error is coming

 

Webpage error details

 

 

 

 

 

Message: Object doesn't support this property or method

 

Line: 98

 

Char: 10

 

 

 

in line 98 I have

 

 

 

chartToPrint.print();

 

 

 

my html code is:

 

[ code ]

 

 

 

 

 

 

 

 

 

 

 

 

width="450" height="300" id="chart_1">

 

 

 

 

 

 

quality="high" width="450"

 

height="300" name="chart_1"

 

allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

 

 

 

 

 

 

 

 

 

 

[/ code ]

Share this post


Link to post
Share on other sites
Guest Rajroop

Hello,

We went through your code and found the registerWithJS parameter not set.

Please follow the following for setting registerWithJS parameter:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" <br>

 width="450" height="300" id="chart_1"><br>

 <param name="allowScriptAccess" value="always" /><br>

 <param name="movie" value="/OA_HTML/eisrs/jsp/dashboard/FC/Column3D.swf"/><br>

 <param name="FlashVars" value="chartWidth=450&chartHeight=300&debugMode=0&registerWithJS=1&dataURL=/OA_HTML/eisrs/jsp/dashboard/XMLData/Column3D_1.xml" /><br>

 <param name="quality" value="high" /><br>

 <embed src="/OA_HTML/eisrs/jsp/dashboard/FC/Column3D.swf" FlashVars="chartWidth=450&chartHeight=300&debugMode=0&registerWithJS=1&dataURL=/OA_HTML/eisrs/jsp/dashboard/XMLData/Column3D_1.xml" <br>

 quality="high" width="450" <br>

 height="300" name="chart_1"<br>

 allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br>

 </object><br>

 

Also, you would need to set the Flash Player global security settings on your computer if you are running the application from a local file system.

Please go through the following link for information on how to set the Flash Player global security settings:

http://www.fusioncharts.com/forum/Topic5009-47-1.aspx#bm8077

I hope this helps. :)

Share this post


Link to post
Share on other sites

Hmmm..,

 

 

 

I am including the FC jsp in my jsp code and passing the registerWithJS=1

 

 

 

 

where my jspURL =FCHTMLRenderer.jsp?chartWidth=450&chartHeight=300&chartId=chart_1&debugMode=false&registerWithJS=1&strURL=../Column3D_1.xml&chartSWF=../Column3D.swf

 

 

 

I have also set the Adobe Flash Player Global Security settings, but still getting the same JS error..

 

Please help

 

Thank you

Share this post


Link to post
Share on other sites

Hi Ramadevi,

 

 

 

I am afraid, that is not the correct way to use registerWithJS parameter.

 

 

 

Instead you would need to put this parameter in FCHTMLRenderer.jsp file.

 

 

 

And you would need to put registerWithJS in movie parameter.

 

 

 

Example:

 

 

 

name="movie" value="/OA_HTML/eisrs/jsp/dashboard/FC/Column3D.swf?.......registerWithJS=1..."

Share this post


Link to post
Share on other sites

Thank you very much, after I gave the registerWithJS in correct place :)

 

 

 

I have 2 more questions.

 

 

 

1.

 

I have issue with save chart as a image ,like print function same way I am using save

 

function ,its not throwing any error but not saving the chart.

 

in XML I have given

 




.....



 

 

 

and js function I am using is:

 

 

 

function saveChart(chartId){

 

//Get chart from its ID

 

var chartToPrint = getChartFromId(chartId);

 

chartToPrint.saveAsImage();

 

}

 

 

 

I think I am doing something wrong somewhere.

 

 

 

2. Please suggest me if there is any way I can write js function when the copy icon is clicked to copy the selected chart data to clip board, which right now is coming on the chart when right clicked and select copy data to clipboard.

Share this post


Link to post
Share on other sites

Hi Ramadevi :)

 
Glad to know this worked.
 
And here are the answers for your queries:
 
1. Currently the method you are using to export chart to image is depreciated, please refer to http://www.fusioncharts.com/docs/ >> Exporting as Image/PDF section to get more information on the same.
 
2. Chart has a method named getDataAsCSV() which returns the XML data, but does not set this data to the clipboard.
 

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