admin管理员组文章数量:1326339
Have implemented Fusion chart in flash format. Is it possible to convert it to pure javascript form? If yes, can you please elaborate how to do it i.e. at which places changes are to be made.
Have implemented Fusion chart in flash format. Is it possible to convert it to pure javascript form? If yes, can you please elaborate how to do it i.e. at which places changes are to be made.
Share Improve this question asked Oct 22, 2013 at 9:53 xtrasxtras 1164 silver badges15 bronze badges2 Answers
Reset to default 6If you are using the latest version of FusionCharts (3.3.0 and above), Just replacing ../Column3D.swf
with Column3D
would do the trick! Ensure you have FusionCharts.HC.js
and FusionCharts.HC.Charts.js
in same folder as FusionCharts.js
. Your code will look like...
<html>
<head>
<title>My First chart using FusionCharts XT - Using pure JavaScript</title>
<script type="text/javascript" src="../FusionCharts.js"></script>
</head>
<body>
<div id="chartContainer">FusionCharts XT will load here!</div>
<script type="text/javascript">
var myChart = new FusionCharts("Column3D", "myChartId", "400", "300");
myChart.setXMLUrl("Data.xml");
myChart.render("chartContainer");
</script>
</body>
</html>
However, I also suggest a more readable code such as...
<html>
<head>
<title>My First chart using FusionCharts XT - Using pure JavaScript</title>
<script type="text/javascript" src="../FusionCharts.js"></script>
<script type="text/javascript">
FusionCharts.addEventListener("ready", function () {
var myChart = new FusionCharts({
type: "column3d",
id: "myChartId",
width: "400",
height: "300",
renderAt: "chartContainer",
dataSource: "Data.xml",
dataFormat: "xmlurl"
}).render();
});
</script>
</head>
<body>
<div id="chartContainer">FusionCharts XT will load here!</div>
</body>
</html>
Please confirm if you are already using FusionCharts XT and now if you wish to render JavaScript charts only, irrespective of whether Flash Player is installed or not, you would simply need to add the following single line of code to your existing implementation.
FusionCharts.setCurrentRenderer('javascript');
This code will ask FusionCharts renderer to skip Flash rendering and create pure JavaScript charts.
The final HTML code will look like the following:
<html>
<head>
<title>My First chart using FusionCharts XT - Using pure JavaScript</title>
<script type="text/javascript" src="../FusionCharts.js"></script>
</head>
<body>
<div id="chartContainer">FusionCharts XT will load here!</div>
<script type="text/javascript">
FusionCharts.setCurrentRenderer('javascript');
var myChart = new FusionCharts( "../Column3D.swf", "myChartId", "400", "300", "0", "1");
myChart.setXMLUrl("Data.xml");
myChart.render("chartContainer");
</script>
</body>
</html>
Also, for rendering JavaScript charts, FusionCharts XT makes use of "FusionCharts.HC.js", "FusionCharts.HC.Charts.js" and "jquery.min.js". These files are present in "Charts" folder of the Download Pack.
You do not need to load these files explicitly in HTML but place it in the same folder as "FusionCharts.js". "FusionCharts.js" automatically takes care of the loading.
Details on pure JavaScript chart rendering is elaborately mentioned in this link.
本文标签: fusionchartsFusion Chartsfrom flash to pure javascriptStack Overflow
版权声明:本文标题:fusioncharts - Fusion Charts, from flash to pure javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742200721a2431909.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论