<?php
/*
* examples from http://d3js.org/
*/
include_once "../d3.classes.inc.php";
?>
<?php echo "Dynamic Properties";?>
<pre>
<?php
$p = d3()->selectAll("p");
$d = clone $p;
$d ->style("color", function(){
return "hsl(". Math()->random() * 360 . ",100%,50%)";
});
echo $d;
?>
<?php
$p->data(array(4, 8, 16, 16, 23, 42))
->enter()->append("p")
->text(function($d){return "I'm number "+ $d + "!";});
echo $p;
|