2
나는 cytoscape를 사용하여 그래프로 쿼리 결과를 표시하려고합니다. 나는 자바 스크립트 전문가가 아니므로 구문 오류 일 수 있습니다. 누군가 내 코드를 살펴볼 수 있습니까?PHP 코드에서 cytoscape 트리 만들기
<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>\
';
어떤 행동을 보이고 있습니까? 오류 메시지가 있습니까? – ernie