public function gbarra_getImagen($titulo = " ", $width = "500", $height = "350") { $config = XTConfig::singleton(); $data = $this->barra_data; $nombreimagen = uniqid() . "barraimagen.png"; $file = $config->get("XTSITE_PATH_ABSOLUTE") . "tmp/pie/" . $nombreimagen; $file_url = $config->get("XTSITE_PATH") . "tmp/pie/" . $nombreimagen; $graph = new PHPGraphLib($width, $height, $file); $graph->addData($data); //$graph->setBarColor('255,255,204'); $graph->setGradient('255,255,204', '254,254,154'); if ($titulo != "") { $graph->setTitle($titulo); } $graph->setLineColor('maroon'); $graph->setDataPointColor('maroon'); $graph->setXValuesHorizontal(true); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataValues(true); $graph->createGraph(); print "<img src=\"{$file_url}\">"; }
<?php error_reporting(0); include "phpgraphlib.php"; $datavalues = $_GET['datavalues']; $showsmall = $_GET['showsmall']; $header = unserialize(urldecode(stripslashes($_GET['header']))); $data = unserialize(urldecode(stripslashes($_GET['mydata']))); $data2 = unserialize(urldecode(stripslashes($_GET['mywebdata']))); if ($showsmall) { $graph = new PHPGraphLib(300, 300); } else { $graph = new PHPGraphLib(500, 300); } $graph->addData($data); $graph->addData($data2); //$graph->setDataValues(true); //$graph->setLegend(true); //$graph->setLegendTitle('Your data','MyWebToNet'); $graph->setXValuesHorizontal(TRUE); $graph->setTitle($header); //$graph->setTitleLocation('left'); $graph->setTextColor('blue'); $graph->setBarColor('blue', 'green'); //$graph->setLegend(TRUE); $graph->createGraph();
//mysqli_select_db($link,'gfb11176') or die('Could not select database'); //mysql_select_db("mydatabase") or die("MySQL Error: " . mysql_error()); $dataArray = array(); // Get the values from the COReadings table for the currently logged in user. $sql = "SELECT COValue, AddedOn FROM COReadings \n\t\tJOIN COUsers ON COUsers.id = COReadings.UserID\n\t\tWHERE COUsers.Email = '{$email}'"; $result = mysqli_query($link, $sql) or die('Query failed: ' . mysql_error()); if ($result) { while ($row = mysqli_fetch_assoc($result)) { $dateAdded = $row["AddedOn"]; $count = $row["COValue"]; // Add to data array $dataArray[$dateAdded] = $count; } } // Configure graph $graph->addData($dataArray); $graph->setTitle("Carbon Monoxide Readings"); $graph->setTitleColor('navy'); $graph->setGradient("lime", "green"); $graph->setBars(false); $graph->setLine(true); $graph->setDataPoints(true); $graph->setDataValues(true); $graph->setDataValueColor('navy'); $graph->setDataPointColor('navy'); $graph->setXValuesHorizontal(true); //$graph->setBackgroundColor("black"); $graph->setYAxisTextColor('black'); $graph->setXAxisTextColor('black'); $graph->setLineColor('navy'); $graph->createGraph();