$result = mysql_query("SELECT Max(player_money_total_amount) max,min(player_money_total_amount) min FROM meridian103.player_money_total;"); while ($row = mysql_fetch_assoc($result)) { $max = $row['max']; $min = $row['min']; } $min -= 1000000; mysql_free_result($result); */ $result = mysql_query("SELECT player_money_total_amount amount, player_money_total_time time from meridian103.player_money_total where date(player_money_total_time) = date(now()) order by player_money_total_time ASC;"); while ($row = mysql_fetch_assoc($result)) { $data[] = array($row['time'], $row['amount']); } mysql_free_result($result); mysql_close($link); //Define the object $plot = new PHPlot(); $plot->SetTitle("Server 103 Total Shillings over Time - Period 1 Day"); $plot->SetFontGD('y_label', 5); $plot->SetFontGD('x_label', 5); //$plot->SetPlotAreaWorld(NULL,$min,NULL,$max); $plot->SetXLabelAngle(90); $plot->SetYDataLabelPos('plotin'); $plot->SetDrawYDataLabelLines('false'); //$plot->SetFontGD('y_title', 5); //$plot->SetFontGD('x_title', 5); $plot->SetDataValues($data); //Turn off X axis ticks and labels because they get in the way: $plot->SetXTickLabelPos('none'); $plot->SetXTickPos('none'); //Draw it $plot->DrawGraph();
# Set defaults: if (!isset($options)) { $options = array(); } $message = 'DrawMessage() test: '; if (empty($text)) { $message .= 'All defaults'; } else { $message .= $text; } if (!empty($extra_chars)) { $message .= str_repeat(' Test', (int) ($extra_chars / 5)); } $p = new PHPlot(800, 600); if (!empty($use_gdfont)) { $p->SetFontGD('generic', 5); } elseif (!empty($use_ttfont)) { $p->SetTTFPath($phplot_test_ttfdir); $p->SetFontTTF('generic', $phplot_test_ttfonts['serifitalic'], 14); } if (!empty($set_bgcolor)) { $p->SetBackgroundColor('yellow'); } if (!empty($set_bgimage)) { $p->SetBgImage('images/bubbles.png', 'tile'); } if (!empty($set_border)) { $p->SetImageBorderWidth(3); $p->SetImageBorderColor('red'); $p->SetImageBorderType('raised'); }
# the minimum percentage of the plot area that the actual pie will use. require_once 'phplot.php'; # Set defaults: if (!isset($suffix)) { $suffix = 'Default min_size, Labels Fit'; } if (!isset($label_size)) { $label_size = 10; } # Built plot title: $title = "Pie Chart Min Size Test: {$label_size} char label"; if (isset($min_size_factor)) { $title .= sprintf(', min size=%d%%', (int) (100 * $min_size_factor)); } $title .= "\n" . $suffix; # This data array is designed to have a long label at 180 degrees, to # make the label-to-pie-to-plot area edge space visible. $label = str_repeat('123456790', (int) ($label_size / 10)) . substr('1234567890', 0, $label_size % 10); $data = array(array($label, 1), array($label, 2), array($label, 1)); $plot = new PHPlot(600, 400); $plot->SetPlotType('pie'); $plot->SetDataType('text-data-single'); $plot->SetDataValues($data); $plot->SetFontGD('generic', 5); $plot->SetTitle($title); $plot->SetPieLabelType('label'); $plot->SetPlotBorderType('full'); if (isset($min_size_factor)) { $plot->pie_min_size_factor = $min_size_factor; } $plot->DrawGraph();
$plot = new PHPlot($width, $height); $plot->SetPlotType('pie'); $plot->SetDataType($data_type); $plot->SetDataValues($data); if (!empty($plot_margins)) { call_user_func_array(array($plot, 'SetMarginsPixels'), $plot_margins); } # Font setup if (!empty($ttfonts)) { if (isset($font_size)) { $plot->SetFontTTF('generic', $phplot_test_ttfonts['sans'], $font_size); } else { $plot->SetFontTTF('generic', $phplot_test_ttfonts['sans']); } } elseif (isset($font_size)) { $plot->SetFontGD('generic', $font_size); } $plot->SetTitle($title); if (!empty($plot_border)) { $plot->SetPlotBorderType($plot_border); } if (isset($pie_diam_factor)) { $plot->pie_diam_factor = $pie_diam_factor; } if (isset($shading)) { $plot->SetShading($shading); } if (isset($label_pos)) { $plot->SetLabelScalePosition($label_pos); } # For backward compatibility testing:
<?php # $Id$ # Dual text types: GD and TTF, default TTF, GD X and Y titles # This requires PHPlot > 5.0.5 require_once 'phplot.php'; # TTF Font info is in this configuration file: require 'config.php'; $data = array(array('', 0, 0, 0), array('', 10, 5, 10)); $p = new PHPlot(800, 600); $p->SetTitle("Dual Text Types:\nDefault TTF, TTF title"); $p->SetDataType('data-data'); $p->SetDataValues($data); $p->SetXTitle('Title of X Data, GD Font 5'); $p->SetYTitle('Title of Y Data, GD Font 3'); $p->SetTTFPath($phplot_test_ttfdir); $p->SetDefaultTTFont($phplot_test_ttfonts['serifitalic']); $p->SetFont('title', $phplot_test_ttfonts['serifbold'], 36); $p->SetFontGD('x_title', 5); $p->SetFontGD('y_title', 3); $p->SetXDataLabelPos('none'); $p->SetLegend(array("Legend Line 1", "Legend Line 2")); $p->SetXTickIncrement(1.0); $p->SetYTickIncrement(1.0); # Draw both grids: $p->SetDrawXGrid(True); $p->SetDrawYGrid(True); $p->SetPlotType('lines'); $p->DrawGraph();
$p = new PHPlot(800, 600); $p->SetTitle($title . $suffix); $p->SetDataType('data-data'); $p->SetDataValues($data); $p->SetImageBorderType('solid'); $p->SetYDataLabelPos('plotin'); if (isset($yd_angle)) { $p->SetYDataLabelAngle($yd_angle); } if (isset($y_type)) { $p->SetYLabelType($y_type, $y_type_arg); } if (isset($yd_type)) { $p->SetYDataLabelType($yd_type, $yd_type_arg); } if (isset($y_label_font)) { if (isset($y_label_font_ttfsize)) { $p->SetFontTTF('y_label', $y_label_font, $y_label_font_ttfsize); } else { $p->SetFontGD('y_label', $y_label_font); } } $p->SetXLabelType('data', 3); $p->SetPlotType($plot_type); if (isset($dvl_angle)) { $p->data_value_label_angle = $dvl_angle; } if (isset($dvl_dist)) { $p->data_value_label_distance = $dvl_dist; } $p->DrawGraph();