Hello,
I’m trying to make a diagram using GraphLinksModel Class. I used the Minimal GoJS Sample as base and i want to fill var with data coming from a php code.
<?php
$nodeList = array ("K", "I", "J", "L", "M", "X", "Z");
$linesList = array();
foreach($nodeList as $key){
$linesList[] = "{key: \"{$key}\" }";
}
$nodeListTwo = implode(',<br>', $linesList);
echo $nodeListTwo;
?>
here ist the Output :
{key: "K" },
{key: "I" },
{key: "J" },
{key: "L" },
{key: "M" },
{key: "X" },
{key: "Z" }
I have used this line var nodeDataArray = JSON.parse( ‘<?php echo json_encode($nodeListTwo) ?>’ ); to make sure
var nodeDataArray =
[
{key: "K" },
{key: "I" },
{key: "J" },
{key: "L" },
{key: "M" },
{key: "X" },
{key: "Z" }
]
but it doesn’t work.
Or is there a way to fill var nodeDataArray and var linkDataArray dynamically ? because each letter comes from an (php) Array.
Thank