本文整理汇总了PHP中PHPlot::SetLabelScalePosition方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetLabelScalePosition方法的具体用法?PHP PHPlot::SetLabelScalePosition怎么用?PHP PHPlot::SetLabelScalePosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetLabelScalePosition方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
# $Id$
# PHPlot Example: Flat Pie with options
require_once 'phplot.php';
$data = array(array('', 10), array('', 20), array('', 30), array('', 35), array('', 5));
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
$plot->SetPlotType('pie');
$colors = array('red', 'green', 'blue', 'yellow', 'cyan');
$plot->SetDataColors($colors);
$plot->SetLegend($colors);
$plot->SetShading(0);
$plot->SetLabelScalePosition(0.2);
$plot->DrawGraph();
示例2: array
if (count($data_array) < 2) {
//don't bother trying to make a graph, if no users.
exit;
}
//Set some data
if ($graph_type == 1) {
//text-data (no time)
$example_data = array($data_array, $data_array);
} else {
//data-data (any extra entries are time).
$example_data = array($data_array);
}
$graph->SetDataValues($example_data);
//Error_Reporting(0);
$graph->SetPlotType($graph_type_str);
$graph->SetLabelScalePosition(1.27);
$graph->SetLegend($legend_array);
if ($graph_type == 2) {
$graph->SetYLabel($element);
$graph->SetXLabel($cw['users']);
} else {
$graph->SetLegendPixels(1, 1, "");
}
//$graph->SetTitle("$element per user");
//Draw it
$graph->DrawGraph();
//list things to change on the graph
} else {
print_header($cw['graphs']);
if (isset($graph_selected) && $graph_selected == 1) {
echo sprintf($st[143], $element) . "<img src='{$_SERVER['PHP_SELF']}?graph_db={$graph_db}&draw_graph=1&graph_type={$graph_type}&remaining={$remaining}' alt='" . sprintf($st[144], $graph_type_str, $element) . "' /><br />" . $st[145] . "</center>";
示例3: BuatPieGraph
function BuatPieGraph($filetujuan, $prevtahun, $tahun, $urutan, $gel)
{
$fg = GetaField("aplikan a left outer join pmbperiod p on a.PMBPeriodID=p.PMBPeriodID and a.KodeID=p.KodeID and p.Tahun='{$tahun}'", "a.SudahBekerja='N' and a.KodeID", KodeID, "count(a.AplikanID)");
$nfg = GetaField("aplikan a left outer join pmbperiod p on a.PMBPeriodID=p.PMBPeriodID and a.KodeID=p.KodeID and p.Tahun='{$tahun}'", "a.SudahBekerja='Y' and a.KodeID", KodeID, "count(a.AplikanID)");
$data = array(array('Fresh Graduate', $fg), array('Non Fresh Graduate', $nfg));
$plot = new PHPlot(800, 600);
//$plot->SetImageBorderType('raised');
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
$plot->SetDataColors(array('red', 'blue', 'green', 'yellow', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'gray', 'orange'));
$plot->setShading(60);
$plot->SetLabelScalePosition(0.2);
$plot->SetFont('generic', 5);
$plot->SetFont('title', 5);
$plot->SetFont('legend', 5);
$plot->SetTitle("Resume % Aplikan Fresh / non Fresh Graduate");
foreach ($data as $row) {
$plot->SetLegend(implode(': ', $row));
}
$plot->SetIsInline(true);
$plot->SetOutputFile($filetujuan);
$plot->DrawGraph();
}
示例4: PHPlot
//Include the code
include "../phplot.php";
//Define the object
$graph = new PHPlot();
$graph->SetPrintImage(0);
//Set some data
$example_data = array(array("a", 1, 2), array("b", 2, 2), array("c", 3, 2), array("d", 5, 2), array("e", 8, 2), array("f", 9, 2), array("f", 4, 2));
$graph->SetPlotAreaWorld(0, 0, 7.5, 10);
$graph->SetVertTickPosition('plotleft');
$graph->SetSkipBottomTick(1);
$graph->SetDataValues($example_data);
$graph->SetDrawYGrid(0);
$graph->SetPlotType('bars');
$graph->SetDrawDataLabels('1');
$graph->SetLabelScalePosition('1');
$graph->SetDataColors(array("orange", "blue"), array("green", "yellow"));
$graph->SetMarginsPixels(50, 50, 50, 50);
$graph->SetLegend(array('Time in Flight', 'Time to Stop'));
//Lets have a legend
$graph->SetLegendWorld(1, 8);
//Lets have a legend position
//Draw it
$graph->DrawGraph();
//////////////////////NEXT SETTINGS
$example_data = array(array("a", 60), array("b", 40), array("c", 50), array("d", 50), array("e", 80), array("f", 90), array("f", 40));
$graph->SetDataValues($example_data);
$graph->SetDataColors(array("red"), array("green"));
$graph->SetDrawXDataLabels(0);
//We already got them in the first graph
$graph->SetPlotAreaWorld(0, 0, 7.5, 100);
示例5: BuatPieGraph
function BuatPieGraph($filetujuan, $prevtahun, $tahun, $urutan, $gel)
{
$fg = GetaField("pmb b left outer join pmbperiod p on b.PMBPeriodID=p.PMBPeriodID and b.KodeID=p.KodeID and LEFT(p.PMBPeriodID, 4)='{$tahun}'", "(b.TahunLulus='{$prevtahun}' or b.TahunLulus='{$tahun}') and b.KodeID", KodeID, "count(b.PMBID)");
$nfg = GetaField("pmb b left outer join pmbperiod p on b.PMBPeriodID=p.PMBPeriodID and b.KodeID=p.KodeID and LEFT(p.PMBPeriodID, 4)='{$tahun}'", "b.TahunLulus < '{$prevtahun}' and b.KodeID", KodeID, "count(b.PMBID)");
$data = array(array('Fresh Graduate', $fg), array('Non Fresh Graduate', $nfg));
$plot = new PHPlot(800, 600);
//$plot->SetImageBorderType('raised');
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
$plot->SetDataColors(array('red', 'blue', 'green', 'yellow', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'gray', 'orange'));
$plot->setShading(60);
$plot->SetLabelScalePosition(0.2);
$plot->SetFont('generic', 5);
$plot->SetFont('title', 5);
$plot->SetFont('legend', 5);
$plot->SetTitle("Persentase Calon Mahasiswa Fresh / non Fresh Graduate");
foreach ($data as $row) {
$plot->SetLegend(implode(': ', $row));
}
$plot->SetIsInline(true);
$plot->SetOutputFile($filetujuan);
$plot->DrawGraph();
}
示例6: guifi_stats_chart06
function guifi_stats_chart06()
{
include drupal_get_path('module', 'guifi') . '/contrib/phplot/phplot.php';
$gDirTTFfonts = drupal_get_path('module', 'guifi') . '/contrib/fonts/';
if (isset($_GET['width'])) {
$gwidth = $_GET['width'];
} else {
$gwidth = 500;
}
if (isset($_GET['height'])) {
$gheight = $_GET['height'];
} else {
$gheight = 450;
}
$today = getdate();
$year = $today[year];
$month = $today[mon];
$month = $month - 12;
$n = 0;
$tot = 0;
if ($month < 1) {
$year = $year - 1;
$month = 12 + $month;
}
$datemin = mktime(0, 0, 0, $month, 1, $year);
if (isset($_GET['zone'])) {
$zone_id = $_GET['zone'];
if ($zone_id == "0") {
$zone_id = "3671";
}
} else {
$zone_id = "3671";
}
$azone = array();
$avalue = array();
$azone[$zone_id] = array($zone_id);
$achilds = array_keys(guifi_zone_childs_tree($zone_id, 1));
foreach ($achilds as $key => $child) {
if ($child != $zone_id) {
$azone[$child] = array();
$avalue[$child] = 0;
$aschilds = guifi_zone_childs($child);
foreach ($aschilds as $skey => $schild) {
array_push($azone[$child], $schild);
}
}
}
$vsql = "select COUNT(*) as num, zone_id\n from {guifi_location}\n where timestamp_created >= " . $datemin . " and status_flag='Working' ";
if ($zone_id != "0") {
$achilds = guifi_zone_childs($zone_id);
$v = "";
foreach ($achilds as $key => $child) {
if ($v == "") {
$v .= "zone_id=" . $child;
} else {
$v .= " or zone_id=" . $child;
}
}
$vsql .= "AND (" . $v . ") ";
}
$vsql .= "GROUP BY zone_id ";
$result = db_query($vsql);
while ($record = db_fetch_object($result)) {
foreach ($azone as $key => $grupzone) {
if (in_array($record->zone_id, $grupzone)) {
$avalue[$key] = $avalue[$key] + $record->num;
}
}
}
foreach ($avalue as $key => $value) {
if ($value != 0) {
$data[] = array(guifi_get_zone_name($key), $value);
$tot = $tot + $value;
}
}
$shapes = array('none');
$plot = new PHPlot($gwidth, $gheight);
$plot->SetPlotAreaWorld(0, 0, NULL, NULL);
$plot->SetImageBorderType('plain');
$plot->SetFileFormat('png');
$plot->SetPlotType("pie");
$plot->SetDataType("text-data-single");
$plot->SetDataValues($data);
$plot->SetDataColors(array('red', 'green', 'blue', 'yellow', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'gray', 'orange'));
$plot->SetTTFPath($gDirTTFfonts);
$plot->SetFontTTF('title', 'Vera.ttf', 12);
$plot->SetFontTTF('legend', 'Vera.ttf', 7);
if (isset($_GET['title'])) {
$plot->SetTitle("guifi.net \n" . t($_GET['title']));
} else {
if ($zone_id == "0") {
$plot->SetTitle("guifi.net \n" . t('Last year'));
} else {
$plot->SetTitle("guifi.net \n" . t('zone') . ": " . guifi_get_zone_name($zone_id) . "\n" . t('Last year'));
}
}
$plot->SetShading(1);
$plot->SetLabelScalePosition(0.45);
$plot->SetLegendStyle("left", "left");
$plot->SetLegendPixels(0, 0);
//.........这里部分代码省略.........
示例7: execute
public function execute( $par ) {
global $wgRequest, $wgOut, $wgLang, $wgAutoloadClasses;
$this->setHeaders();
$this->outputHeader();
if ( !class_exists( 'PHPlot' ) && !isset($wgAutoloadClasses['PHPlot'] ) ) {
$wgOut->addWikiMsg( 'uos-warn' );
return;
}
$par = trim(strtolower($par));
foreach ( $this->blacklist as $b ) {
if ( $b === $par ) {
$par = false;
break;
}
}
if ( !$par ) {
$opts = array();
$hiddenoptions = $this->getHiddenOptions();
$name = SpecialPage::getTitleFor( 'UserOptionStats' )->getPrefixedText();
foreach ( $this->getOptions() as $k ) {
if( in_array( $k, $hiddenoptions ) ) {
continue; # List hidden options separately (see below)
}
$opts[] = "[[$name/$k|$k]]";
}
$wgOut->addWikiMsg( 'uos-choose', $wgLang->commaList( $opts ) );
if ( count( $hiddenoptions ) > 0 ) {
$hiddenopts = array();
foreach ( $hiddenoptions as $hk ) {
$hiddenopts[] = "[[$name/$hk|$hk]]";
}
$wgOut->addWikiMsg( 'uos-choose-hidden', $wgLang->commaList( $hiddenopts ) );
}
return;
}
$dbr = wfGetDB( DB_SLAVE );
$users = $dbr->select( 'user', '*', '', __METHOD__ );
$data = array();
$optionName = $par;
foreach ( $users as $u ) {
// New from row doesn't load user_properties, hence this is slow!
$obj = User::newFromRow( $u );
$opt = $obj->getOption( $optionName, wfMsg( 'uos-unknown' ) );
if ( !isset($data[$opt]) ) $data[$opt] = 0;
$data[$opt]++;
}
$realdata = array();
$labels = array();
// Most popular first, barring other
arsort( $data );
// After more than 7 the default colors start to loop :(
// So use the last free color for "other" which includes the rest
$max = 7;
$rest = array_slice( $data, $max );
$data = array_slice( $data, 0, $max );
foreach ( $data as $k => $d ) {
$labels[] = "$k ($d)";
$realdata[] = array( $k, $d );
}
if ( count($rest) ) {
$other = 0;
foreach ( $rest as $v ) $other += $v;
$labels[] = wfMsg( 'uos-other' ) . " ($other)";
$realdata[] = array( 'other', $other );
}
$title = $wgRequest->getText( 'pietitle', wfMsg( 'uos-title', $optionName ) );
$width = $wgRequest->getInt( 'width', 700 );
$height = $wgRequest->getInt( 'height', 500 );
$width = max( 200, min( 1000, $width ) );
$height = max( 200, min( 1000, $height ) );
$shading = $wgRequest->getInt( 'shading', 10 );
$height = max( 0, min( 1000, $height ) );
// Define the object
$plot = new PHPlot( $width, $height );
$plot->SetDataType('text-data-single');
$plot->setDataValues( $realdata );
$plot->SetPlotType('pie');
$plot->SetLegend($labels);
$plot->SetShading( $shading );
$plot->SetLabelScalePosition(0.3);
$plot->SetTitle( $title );
// Better fonts
$realFunction = array( 'FCFontFinder', 'find' );
if ( is_callable( $realFunction ) ) {
$font = FCFontFinder::find( $wgLang->getCode() );
if ( $font ) {
//.........这里部分代码省略.........
示例8: elseif
} 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:
if (isset($precision_y)) {
$plot->SetPrecisionY($precision_y);
}
if (!empty($pie_label_args)) {
call_user_func_array(array($plot, 'SetPieLabelType'), $pie_label_args);
}
// For test using colors as labels:
if (!empty($data_colors)) {
$plot->SetDataColors($data_colors);
}
$plot->DrawGraph();
示例9: array
# Different data set test cases.
# If the numbers sum to 360, units are degrees.
switch ($tp['case']) {
case 1:
$descript = 'Case 1, slice 2(green)=0';
$data = array(array('', 50), array('', 0), array('', 20), array('', 50), array('', 100), array('', 60), array('', 50), array('', 2));
break;
case 2:
$descript = 'Case 2, first(red) and last(cyan)=0';
$data = array(array('', 0), array('', 33), array('', 66), array('', 33), array('', 0));
break;
case 3:
$descript = 'Case 3, adjacent slices 6(magenta) and 7(purple)=0';
$data = array(array('', 36), array('', 36), array('', 36), array('', 36), array('', 36), array('', 0), array('', 0), array('', 36), array('', 36), array('', 36), array('', 36), array('', 36));
break;
}
$plot = new PHPlot(800, 600);
$plot->SetTitle("Pie Charts with Zero-size Slices\n" . $descript . $tp['suffix']);
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
$plot->SetDataColors($colors);
# Make the legend line count match the data array size:
$plot->SetLegend(array_slice($colors, 0, count($data)));
if (isset($tp['shading'])) {
$plot->SetShading($tp['shading']);
}
if (isset($tp['labelpos'])) {
$plot->SetLabelScalePosition($tp['labelpos']);
}
$plot->DrawGraph();