PHP Classes
elePHPant
Icontem

File: demos/001.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  d3  >  demos/001.php  >  Download  
File: demos/001.php
Role: Example script
Content type: text/plain
Description: Some basic ops
Class: d3
Output charts using D3.js JavaScript library
Author: By
Last change:
Date: 2 years ago
Size: 452 bytes
 

Contents

Class file image Download
<?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;