Sign in to follow this  
mtm81

object doesn't support this property or method on saveimage()

Recommended Posts

Hi,

I have the save image functionality working if I right click the chart

(I'm using a gantt widget chart)

however I run the saveimage from a button click.

therefore I have the following function in the head tag of my page:

function saveChart(){

//Get chart from its ID

var chartToPrint = getChartFromId("chartdiv");

chartToPrint.saveAsImage();

  }

I run this from an onclick behaviour on a button my page.

the code for rendering the chart is as follows:

<div id="chartdiv" align="center">Loading Time Planning . . .</div>

<script type="text/javascript">

 var myChart = new FusionCharts("Charts/Gantt.swf", "chartdiv", "<%=ChartWidth%>", "500", "0", "1");

 myChart.setDataURL("<%=DataUrl%>");

 myChart.render("chartdiv");

</script>

I have made sure I'm up to date with the latest version of both the charts and the widgets of which I have both...

I've also tried editing the "myChart=" line to be:

var myChart = new FusionCharts("Charts/Gantt.swf?RegisterwithJS=1", "chartdiv", "<%=ChartWidth%>", "500", "0", "0");

and I still get the same error

any ideas?

James

Share this post


Link to post
Share on other sites

Hi,

 
Please use unique id for DIV and chart.
 
Wrong:

<div id="chartdiv" align="center">Loading Time Planning . . .</div>

<script type="text/javascript">

 var myChart = new FusionCharts("Charts/Gantt.swf", "chartdiv", "<%=ChartWidth%>", "500", "0", "1");

 myChart.setDataURL("<%=DataUrl%>");

 myChart.render("chartdiv");

</script>

It should be:

 

 

<div id="chartdiv" align="center">Loading Time Planning . . .</div>

<script type="text/javascript">

 var myChart = new FusionCharts("Charts/Gantt.swf", "chartID", "<%=ChartWidth%>", "500", "0", "1");

 myChart.setDataURL("<%=DataUrl%>");

 myChart.render("chartdiv");

</script>

Also in Script:

function saveChart(){

//Get chart from its ID

var chartToPrint = getChartFromId("chartID");

chartToPrint.saveAsImage();

  }

Edited by Guest

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