Fusion Charts setCurrentRenderer(‘javascript’)问题
作者:互联网
我有以下HTML代码.这是工作.
<html>
<head>
<title>My First chart using FusionCharts - Using pure JavaScript</title>
<script type="text/javascript" src="http://www.fusioncharts.com/lib/jquery/jquery-1.6.2.min.js"></script>
<script language="JavaScript" src="http://www.fusioncharts.com/lib/js/FusionCharts.js"></script>
<script language="JavaScript" src="http://www.fusioncharts.com/lib/js/FusionCharts.HC.js"></script>
<script language="JavaScript" src="http://www.fusioncharts.com/lib/js/FusionCharts.HC.Charts.js"></script>
<script language="JavaScript" src="http://www.fusioncharts.com/lib/js/jquery.min.js"></script>
</head>
<body>
<div id="chartContainer">FusionCharts will load here!</div>
<script type="text/javascript">
//FusionCharts.setCurrentRenderer('javascript');
var chartObj = new FusionCharts({
swfUrl: "http://www.fusioncharts.com/demos/gallery/Charts/Column2D.swf",
width: "500",
height: "300",
id: 'sampleChart',
dataSource: "http://www.fusioncharts.com/demos/gallery/Data/Col2D1.xml",
dataFormat: FusionChartsDataFormats.XMLURL,
renderAt: 'chartContainer'
}).render();
</script>
</body>
</html>
当我使用setCurrentRenderer javascripde模式时.它给了我“没有数据可显示”.
编辑:示例源-http://www.fusioncharts.com/demos/gallery/column-and-bar/chart.asp?id=column2d_1
解决方法:
从FusionCharts网站以JavaScript加载数据会导致跨域错误.它是浏览器本身内置的安全性.
XMLHttpRequest无法加载http://www.fusioncharts.com/demos/gallery/Data/Col2D1.xml. Access-Control-Allow-Origin不允许使用原始http:// localhost.
尝试将JavaScript文件,Flash文件和XML数据托管在您自己的本地服务器上,它应该可以正常工作.
标签:fusioncharts,javascript 来源: https://codeday.me/bug/20191101/1983949.html