"lc", //A line chart, data points are spaced evenly along the x-axis.
"linechart2" => "lxy", //Too much to say here, check the chart types page on Google.
"sparklines" => "ls", //Exactly what you think :)
"barchart1" => "bhs", // Too much to say here, check the chart types page on Google.
"barchart2" => "bhg", //Too much to say here, check the chart types page on Google.
"barchart3" => "bvs", //Too much to say here, check the chart types page on Google.
"barchart4" => "bvg", //Too much to say here, check the chart types page on Google.
"piechart1" => "p", //A 2D Pie chart
"piechart2" => "p3", //A 3D Pie chart
"venndiagram" => "v", //Its a...well, Venn diagram!
"scatterplot" => "s", //....
"radarchart1" => "r",
"radarchart2" => "rs",
"map" => "chtm", //Renders a map of the provided region
"googlemeter" => "gom" //Gotta see it to believe it...
//I'm not going to do QC barcodes...no point for the purpose of this code
);
var $params;
function set_data($values){
foreach($values as $s){
$temp .= "{$s},";
}
$temp = substr($temp,0,strlen($temp)-1);
$this->params["chd"] = "t:{$temp}";
}
function set_labels($values){
foreach($values as $s){
$temp .= "{$s}|";
}
$temp = substr($temp,0,strlen($temp)-1);
$this->params["chl"] = $temp;
}
function set_colors($values){
foreach($values as $s){
$temp .= "{$s},";
}
$temp = substr($temp,0,strlen($temp)-1);
$this->params["chco"] = $temp;
}
function set_size($values){
$this->params["chs"] = "{$values[0]}x{$values[1]}";
}
function set_type($values){
$this->params["cht"] = $values;
}
function done(){
foreach($this->params as $k =>$s){
$temp .= "{$k}={$s}&";
}
$temp = substr($temp,0,strlen($temp)-1);
return "{$this->api}{$temp}";
}
}
class VerticalBarchart extends chart{ function VerticalBarchart(){ $this->params["cht"] = "bvg"; }}
class Piechart2D extends chart{ function Piechart2D(){ $this->params["cht"] = "p"; }}
class Piechart3D extends chart{ function Piechart3D(){ $this->params["cht"] = "p3"; }}
class GoogleMeter extends chart{ function GoogleMeter(){ $this->params["cht"] = "gom"; }}
class HorizontalBarchart extends chart{ function VerticalBarchart(){ $this->params["cht"] = "bhs"; }}
// Connect to CodeCall DB
// Create the MySQLi class/connection
$mysqli = new mysqli("localhost", "codecall_ccforum", "cdefgab7k", "codecall_forum");
// Test the Connection
if (mysqli_connect_errno()) {
die("MySQLi Connect failed: " . mysqli_connect_error());
}
// Query the Database
$result = $mysqli->query("SELECT * FROM `post` where visible=1");
$rowCount = $mysqli->affected_rows;
$mysqli->close();
// Get the percentage
$data = (int) (($rowCount / 100000) * 100);
$remaining = 100 - $data;
$c = new HorizontalBarchart();
$c->set_data(array($data, $remaining));
$c->set_size(array(100,100));
$c->set_labels(array("Posts", "Goal"));
$c->set_colors(array("0000ff"));
///$c->set_colors(array("ff3344", "11ff11"));
echo "Goal: 100,000 Posts
";
echo "Complete: {$data}%
";
echo "
done()}\" border=0/>";
?>