how to supply data to a php array from an external file?
i am using phplot to plot a graph in a web page, and i have the following
code for it,
<?php
//Include the code
require_once 'C:/xampp/htdocs/phplot-6.1.0/phplot.php';
//Define the object
$plot = new PHPlot();
//Define some data
$example_data = array(
array('a',3),
array('b',5),
array('c',7),
array('d',8),
array('e',4),
array('f',6),
array('g',7)
);
$plot->SetDataValues($example_data);
//Turn off X axis ticks and labels because they get in the way:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
//Draw it
$plot->DrawGraph();
?>
i don't want to define the data as in $example_data, but i want to read or
upload this from an external file like txt or json, please suggest how to
achieve this and what can be the type of the external file to be uploaded
?
No comments:
Post a Comment