In this example we will be exploring the Simple Line Graph using the php-d3-lib.
*renders graph into element with id="graph"
// if not included already, include the autoloader include('../PhpD3/autoloader.php'); $data = array( 'data_file'=>'graph_data.tsv', 'dimensions'=>array( 'height'=>500, 'width'=>950 ), 'render_element'=>array( 'value'=>'graph', 'type'=>'id' ), 'axis_data'=>array( 'x_axis_label'=>'letter', 'y_axis_label'=>'frequency', ), 'file_type'=>'tsv', 'autosize' => true ); $graph = new PhpD3\Draw('simple_line_graph',$data); $graph_render = $graph->render();
*renders graph into element with id="graph_2"
// if not included already, include the autoloader include('../PhpD3/autoloader.php'); $data = array( 'data_file'=>'graph_data.tsv', 'dimensions'=>array( 'height'=>500, 'width'=>950 ), 'render_element'=>array( 'value'=>'graph_2', 'type'=>'id' ), 'axis_data'=>array( 'x_axis_label'=>'letter', 'y_axis_label'=>'frequency', ), 'file_type'=>'tsv', ); $graph = new PhpD3\Draw('simple_line_graph',$data); $graph_render = $graph->render();