我正在尝试使用 cytoscape 显示带有图形的查询结果。我不是javascript专家,所以可能只是语法错误,有人可以看看我的代码吗?
<script type="text/javascript">
window.onload = function() {
// id of Cytoscape Web container div
var div_id = "cytoscapeweb";
// NOTE: - the attributes on nodes and edges
// - it also has directed edges, which will automatically display edge arrows
var xml = '\
<graphml>\
<key id="label" for="all" attr.name="label" attr.type="string"/>\
<key id="weight" for="node" attr.name="weight" attr.type="double"/>\
<graph edgedefault="directed">\
<node id="1">\
<?php echo "<data key=\"label\">$prot</data>\\\n";?>
<data key="weight">2.0</data>\
</node>
<?php $count=2;?>
<?php while($row = mysql_fetch_array($result)){
echo "<node id=\"$count\">\\";
echo "<data key=\"label\">$row['interactor']</data>\\";
echo "<data key=\"weight\">1.0</data>\\";
echo "</node>\\";
echo "<edge source="1" target=\"$count\">\\";
echo "<data key=\"label\">$prot to $row['interactor']</data>\\";
echo "</edge>\\";
$count++;
}?>
</graph>\
</graphml>\
';