PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Tom Schaefer   d3   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: show hints
Class: d3
Output charts using D3.js JavaScript library
Author: By
Last change: add comment
Date: 11 years ago
Size: 2,474 bytes
 

Contents

Class file image Download
This set of classes is for creating d3 javascript charts. @see http://d3js.org/ While writing php it stacks variables, methods etc. and generates javascript code on echo. d3 charts can be written by following the fluid design pattern. So you can easily translate any d3 javascript example into php source. It supports closures, variables, methods and more. By using this class set there is no need to write html full of nearly unreadable javascript code. You can develop and write your own reusable and customizable php wrapper classes for creating d3 graphs, charts etc. The main goal of this class to provide an easy to use a php interface to the wonderful d3 library. PHP based and server side chart generation of d3 charts in a d3 related object notation is now available. Go to http://d3js.org/ and get an impression of what you can do with this class set. Instructions You can translate d3 javascript code into php code by following rules: - php arrows (->) become to javascript dots (.) - php variable dollar prefixes ($) will be removed - php closures will be transformed to javascript closures - php concatenating dots (.) within closures will be translated to javascript plus operators (+) - php is written fluently - by cloning a d3 php code new instances will created holding a copy of the original d3 js code - each d3 method is available is as magic php method within the scope of a d3 php object - js variables can be created by using d3::variable - js functions can be created by using f3 - js objects can be created by using o3 Take a look at example 002.php and see how it works. For more complex graphs examine the classes d3ClusterDendrogram (demos/005.php), d3Treemap (demos/004.php) or ReingoldTilfordTree (demos/006.php). If you created your own class, please tell me. If there is sufficient feedback I will provide an open source git hub respository where all these classes and a extensive documentation will reside. Regards Thomas Schäfer P.S.: You can easily adapt following library (http://nvd3.org/livecode/ ) which offers d3 models. This allows you to write less php code while creating stunning charts. Combined with canvg library you can export the svg charts while operating with the canvas object of supporting browsers and save them as image. But that is another story. ;-) - added an autocompletion support file. do not load this file in an ide only. do not use it in production mode.