function make_graph_multi_line($title, $data_min, $data_avg, $data_max, $is_bar_graph) { include 'phpgraphlib.php'; $graph = new PHPGraphLib(780, 300); if ($is_bar_graph == 'true') { $graph->setBars(true); $graph->setLine(false); } else { $graph->setBars(false); $graph->setLine(true); } $graph->setDataPoints(true); $graph->setDataPointSize(4); $graph->setDataPointColor('purple'); $graph->setLegend(true); if (!isset($data_min)) { $graph->addData($data_avg); $graph->addData($data_max); if ($is_bar_graph == 'true') { $graph->setBarColor('purple', 'red'); } else { $graph->setLineColor('purple', 'red'); } $graph->setLegendTitle('avg', 'max'); } else { $graph->addData($data_min); $graph->addData($data_avg); $graph->addData($data_max); if ($is_bar_graph == 'true') { $graph->setBarColor('blue', 'purple', 'red'); } else { $graph->setLineColor('blue', 'purple', 'red'); } $graph->setLegendTitle('min', 'avg', 'max'); } $graph->setTitle($title); $graph->setTitleColor("88,89,91"); $graph->setXValuesVertical(true); $graph->createGraph(); }
<?php include '../phpgraphlib.php'; $graph = new PHPGraphLib(350, 280); $data = array("Roger" => 145, "Ralph" => 102, "Rhonda" => 123, "Ronaldo" => 137, "Rosario" => 149, "Robin" => 99, "Robert" => 88, "Rustof" => 111); $graph->setBackgroundColor("black"); $graph->addData($data); $graph->setBarColor('255, 255, 204'); $graph->setTitle('IQ Scores'); $graph->setTitleColor('yellow'); $graph->setupYAxis(12, 'yellow'); $graph->setupXAxis(20, 'yellow'); $graph->setGrid(false); $graph->setGradient('silver', 'gray'); $graph->setBarOutlineColor('white'); $graph->setTextColor('white'); $graph->setDataPoints(true); $graph->setDataPointColor('yellow'); $graph->setLine(true); $graph->setLineColor('yellow'); $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();
<?php include '../phpgraphlib.php'; $graph = new PHPGraphLib(450, 300); $data = array("Jan" => -10.1, "Feb" => -3.6, "Mar" => 11.0, "Apr" => 30.7, "May" => 48.6, "Jun" => 59.8, "Jul" => 62.5, "Aug" => 56.8, "Sep" => 45.5, "Oct" => 25.1, "Nov" => 2.7, "Dec" => -6.5); $graph->addData($data); $graph->setBarColor('navy'); $graph->setupXAxis(20, 'blue'); $graph->setTitle('Average Temperature by Month, in Fairbanks Alaska'); $graph->setTitleColor('blue'); $graph->setGridColor('153,204,255'); $graph->setDataValues(true); $graph->setDataValueColor('navy'); $graph->setDataFormat('degrees'); $graph->setGoalLine('32'); $graph->setGoalLineColor('red'); $graph->createGraph();
<?php include 'phpgraphlib.php'; $graph = new PHPGraphLib(350, 280); $data = array("Day1" => 0.5, "Day2" => 0, "Day3" => 0.5, "Day4" => 0, "Day5" => 0.5, "Day6" => 0, "Day7" => 1, "Day8" => 0, "Day9" => 2.5); //$graph->setBackgroundColor("black"); $graph->addData($data); $graph->setBarColor('255,255,204'); $graph->setTitle('Workout Summary'); $graph->setTitleColor('black'); $graph->setupYAxis(15, 'black'); $graph->setupXAxis(20, 'black'); $graph->setGrid(false); $graph->setGradient('blue', 'white'); $graph->setBarOutlineColor('white'); $graph->setTextColor('black'); $graph->setDataPoints(true); $graph->setDataPointColor('red'); $graph->setLine(true); $graph->setLineColor('red'); $graph->createGraph();