我正在使用fusionCharts套件中的fusionmaps。我已经搜索了他们所有的文档和知识库,看看如何做到这一点,但没有运气,所以我正在与你们联系。
我有一个地图(swf文件),它从xml doc获取数据以构建其数据。在该xml中,对于特定实体,我能够进行javascript调用。在swf所在的文件中,我有我的JS和jquery库。我最终试图在UI对话框中弹出另一个swf文件。如果可能的话,我不知道该怎么做。我弹出对话框,但它是空的。我希望放在那里的swf文件加载到我的另一个swf文件之上。有什么建议吗?
以下是我的一些代码。
<script type="text/javascript"><!--
$(document).ready(function() {
$("#dialogContainer").dialog({
bgiframe: true,
height: 500,
width: 600,
modal: true,
autoOpen: false,
buttons: { "Close": function() { $(this).dialog("close"); }},
show: 'fold',
hide: 'fold'
});
}); //Close ready function
function loadDialog(continent) {
//var url = 'showDetails.cfm?region=' + continent;
//$("#dialogContainer").html('Loading. Please wait...');
$.ajax({
type: "post",
url: 'showDetails.cfm',
cache: false,
//dataType: 'html',
data: 'region=' + continent,
beforeSend: function() {$('#dialogContainer').html('Loading. Please wait...').dialog('open');},
success: function(msg) {$('#dialogContainer').html(msg);},
error: function(msg) {$('#dialogContainer').html(msg);}
});
}
我的fusionmap调用
<script type="text/javascript">
var map = new FusionMaps("Maps/FCMap_World8.swf", "Map1Id", "500", "300", "0", "0");
map.setDataURL("WorldData2.xml");
map.render("mapdiv");
</script>
我知道这是一个关于这个问题的远景,但只是希望。感谢您的关注和任何建议。
克里斯
答案 0 :(得分:0)
我可以转发在jQuery模式窗口(对话框)上渲染FusionCharts所需的资源和示例代码。
在PowerCharts code samples文档中提供了与FusionCharts相同(使用LinkedCharts)功能的非常不同的实现。
在您网页上的任意位置,创建一个空白&lt; div&gt;并给它一个独特的身份。
<div id="chart-container"></div>
在页面加载(jQuery document ready)上将前面创建的除法转换为jQuery对话框。
<script type="text/javascript"><!-- // Globally accessible variable for later use var jqDialog; // Create dialog box on document ready. $(document).ready(function() { jqDialog = $('#chart-container').dialog({ autoOpen: false, width: 550, height: 320, title : 'FusionCharts in jQuery Dialog' }); }); var myChart = new FusionCharts({ swfUrl: 'Charts/Column2D.swf', width: '100%', height: '100%', renderAt: 'chart-container' }); // --></script>
现在,我们创建一个JavaScript函数来加载FusionCharts并打开对话框。
<script type="text/javascript"><!-- function loadChartInDialog () { jqDialog.dialog('open'); // open dialog myChart.setXMLUrl('Data.xml'); // set data of chart myChart.render(); // render the chart. } //--></script>
现在,如果需要,用户可以调用此loadChartInDialog
函数打开对话框并加载图表。
答案 1 :(得分:0)
如果您之前使用的是FusionCharts 3.2版本,则需要将图表的wmode设置为不透明或透明。
这里有一个示例可以提供帮助:
http://www.igcomm.com/show/maps/drill/jQuery
这里使用3.1 FusionMaps和3.1.1 FusionCharts。截图如下:
代码如下:
<html>
<head>
<!-- Load FusionMaps 3.1 JavaScript wrapper -->
<script language="JavaScript" src="FusionMaps.js"></script>
<!-- Load FusionCharts 3.1.1 JavaScript wrapper -->
<script language="JavaScript" src="FusionCharts.js"></script>
<!-- Load jQuery UI resources to load jQuery dialog -->
<link href="jquery.ui/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="jquery.ui/jquery.min.js" type="text/javascript"></script>
<script src="jquery.ui/jquery-ui.min.js" type="text/javascript"></script>
</head>
<body>
<!-- Declare map and chart container DIVs -->
<div id="mapdiv" align="center">FusionMaps will load here!</div>
<div id="chartContainer" style="width:300px;height:300px;">FusionCharts will load here!</div>
<script type="text/javascript"><!--
// Declare jQuery dialog on the chart container
var dialog;
$(document).ready(function() {
dialog = $('#chartContainer').dialog({
autoOpen: false,
width: 340,
height: 370,
});
});
// Define and render map of World
// In the XML data of the map each entity is linked to a JavaScript function showChart
// where respective entity id is passed
var map = new FusionMaps("FCMap_World.swf", "Map1Id", "700", "450", "0", "0");
// set map to opaque mode
map.setTransparent(false);
// If you wish you can set map to transparent mode uncommenting the line below
//map.setTransparent(true);
map.setDataURL("mapdata.xml");
map.render("mapdiv");
// This function is called when a Map entity is clicked
// It takes id as parameter where respective entity id is passed
function showChart(id)
{
// Stores the full name of each entity with resepct to the id
var mapNames = {"NA" : "Noth America" , "SA" : "South America" , "AS" : "Asia" , "EU" : "Europe", "AF" : "Africa", "AU" : "Australia"};
// Render chart
var chart = new FusionMaps("Pie2D.swf", "chartId", "300", "300", "0", "0");
// Set chart to opaque mode
chart.setTransparent(false);
// f you wish you can set chart to transparent mode uncommenting the line below
//chart.setTransparent(true);
// In this simple same detailed data for each map is stored in different files
// The files are named as per the id
chart.setDataURL(id+"Chart.xml");
chart.render("chartContainer");
// Sets the dialog's title with the full name of the clicked entity
dialog.dialog( "option", "title", 'Chart of ' + mapNames[id] );
// Show the jQuery dialog which contains the chart
dialog.dialog('open');
}
// -->
</script>
</body>
</html>
也有源代码下载:http://www.igcomm.com/show/maps/drill/jQuery/download.zip。