无法使用“使用/嵌入图表”导出 fusionchart标签'

发布于 2024-10-09 17:07:25 字数 2214 浏览 6 评论 0原文

我正在尝试导出使用“使用/标签嵌入图表”创建的融合图表。

右键单击(在图表上)并选择要导出的 pdf 文件,导出效果非常完美。 但我无法通过 javascript 完成这项工作。我在图表外部有一个按钮,单击该按钮后会调用

function myexport()
{
 var cObject = getChartFromId('Column3D');
        if( cObject.hasRendered() ) cObject.exportChart({exportFormat: 'PDF'});
}

上面返回的对象下方的函数,该函数在下一行上失败,

这是完整的原型

<html>
 <head>
<title>My Chart</title>
<script type="text/javascript" src="fusionCharts.debug.js"></script>
<script type="text/javascript" src="fusionChartsExportComponent.js"></script>
<script type="text/javascript">
    function ExportMyChart() {
        var cObject = getChartFromId('Column3D');
        if( cObject.hasRendered() ) cObject.exportChart({exportFormat: 'PDF'});
 }
</script>
  </head>
  <body>
     <object width="400" height="400" id="Column3D" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"    codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" >         
<param name="testname" value="Column3D.swf" />         
<param name="FlashVars" value="&dataURL=testData.xml&chartWidth=400&chartHeight=300&DOMId=myChart1&registerWithJS=1&debugMode=0">
<param name="quality" value="high" />         
<embed src="Column3D.swf" 
    flashVars="&dataURL=testData.xml&chartWidth=400&chartHeight=300&DOMId=myChart1&registerWithJS=1&debugMode=0"
    width="400" height="300" name="Column3D" quality="high" type="application/x-shockwave-flash"    pluginspage="http://www.macromedia.com/go/getflashplayer" />      
</object>

<!-- We also create a DIV to contain the FusionCharts client-side exporter component -->
<div id="holderDiv" align="center">FusionCharts Export Handler Component</div>
<script type="text/javascript">

 var myExportComponent = new FusionChartsExportObject("testExporter1", "FCExporter.swf");

//Render the exporter SWF in our DIV fcexpDiv
myExportComponent.Render("holderDiv");
</script>
<input type="button" value="Export My Chart" onclick="ExportMyChart()" />

I am trying to export a fusion chart created using 'Embedding Charts Using / Tags'.

Export works just perfect with the right click (on the chart) and chose a pdf to export.
But I am not able to make this work via javascript. I have a button outside the chart which upon clicking calls the function below

function myexport()
{
 var cObject = getChartFromId('Column3D');
        if( cObject.hasRendered() ) cObject.exportChart({exportFormat: 'PDF'});
}

the object above returned is null and this fails on the next line

here is the full prototype

<html>
 <head>
<title>My Chart</title>
<script type="text/javascript" src="fusionCharts.debug.js"></script>
<script type="text/javascript" src="fusionChartsExportComponent.js"></script>
<script type="text/javascript">
    function ExportMyChart() {
        var cObject = getChartFromId('Column3D');
        if( cObject.hasRendered() ) cObject.exportChart({exportFormat: 'PDF'});
 }
</script>
  </head>
  <body>
     <object width="400" height="400" id="Column3D" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"    codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" >         
<param name="testname" value="Column3D.swf" />         
<param name="FlashVars" value="&dataURL=testData.xml&chartWidth=400&chartHeight=300&DOMId=myChart1®isterWithJS=1&debugMode=0">
<param name="quality" value="high" />         
<embed src="Column3D.swf" 
    flashVars="&dataURL=testData.xml&chartWidth=400&chartHeight=300&DOMId=myChart1®isterWithJS=1&debugMode=0"
    width="400" height="300" name="Column3D" quality="high" type="application/x-shockwave-flash"    pluginspage="http://www.macromedia.com/go/getflashplayer" />      
</object>

<!-- We also create a DIV to contain the FusionCharts client-side exporter component -->
<div id="holderDiv" align="center">FusionCharts Export Handler Component</div>
<script type="text/javascript">

 var myExportComponent = new FusionChartsExportObject("testExporter1", "FCExporter.swf");

//Render the exporter SWF in our DIV fcexpDiv
myExportComponent.Render("holderDiv");
</script>
<input type="button" value="Export My Chart" onclick="ExportMyChart()" />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最美的太阳 2024-10-16 17:07:25

在融合图表论坛上找到了答案。当图表的浏览器中同时使用嵌入标签和对象标签时,导出似乎存在问题。

已解释此问题的解决方法
此处

found the answer for this on fusion charts forum. Looks like there is an issue with the export when both embed and object tag are used in the browser for the chart.

Workaround for this one was explained
here

半衾梦 2024-10-16 17:07:25

请在下面找到修改后的代码:

我的图表

function ExportMyChart()
{

var cObject = document.getElementById('Column3D');

if( cObject.hasRendered && cObject.hasRendered())
cObject.exportChart({exportFormat: 'PDF'});
}

FusionCharts Export Handler Component

var myExportComponent = new FusionChartsExportObject("fcExporter1", "../../FusionCharts/FCExporter.swf");

myExportComponent.Render("holderDiv");

希望这有帮助。

Please find the modified code below:

My Chart

function ExportMyChart()
{

var cObject = document.getElementById('Column3D');

if( cObject.hasRendered && cObject.hasRendered())
cObject.exportChart({exportFormat: 'PDF'});
}

FusionCharts Export Handler Component

var myExportComponent = new FusionChartsExportObject("fcExporter1", "../../FusionCharts/FCExporter.swf");

myExportComponent.Render("holderDiv");

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文