本文整理汇总了PHP中PHPlot::SetTransparentColor方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetTransparentColor方法的具体用法?PHP PHPlot::SetTransparentColor怎么用?PHP PHPlot::SetTransparentColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetTransparentColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
# This is a parameterized test. Other scripts can set $tp and then include
# this script. The parameters are shown in the defaults array below:
if (!isset($tp)) {
$tp = array();
}
$tp = array_merge(array('title' => 'Transparent Background', 'suffix' => " (default)", 'FFormat' => NULL), $tp);
require_once 'phplot.php';
$data = array(array('', -4, -64, 16, 40), array('', -3, -27, 9, 30), array('', -2, -8, 4, 20), array('', -1, -1, 1, 10), array('', 0, 0, 0, 0), array('', 1, 1, 1, -10), array('', 2, 8, 4, -20), array('', 3, 27, 9, -30), array('', 4, 64, 16, -40));
$p = new PHPlot();
# File format GIF or PNG, to test transparency:
if (isset($tp['FFormat'])) {
$p->SetFileFormat($tp['FFormat']);
}
# Background color will be transparent:
$p->SetBackgroundColor('yellow');
$p->SetTransparentColor('yellow');
$p->SetTitle($tp['title'] . $tp['suffix']);
$p->SetDataType('data-data');
$p->SetDataValues($data);
# We don't use the data labels (all set to '') so might as well turn them off:
$p->SetXDataLabelPos('none');
# Need to set area and ticks to get reasonable choices.
$p->SetPlotAreaWorld(-4, -70, 4, 80);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(10);
# Don't use dashes for 3rd line:
$p->SetLineStyles('solid');
# Make the lines thicker:
$p->SetLineWidths(3);
# Draw both grids:
$p->SetDrawXGrid(True);
示例2: guifi_stats_chart07
//.........这里部分代码省略.........
}
$datemin = mktime(0, 0, 0, $month, 1, $year);
if (isset($_GET['zone'])) {
$zone_id = $_GET['zone'];
if ($zone_id == "0") {
$zone_id = "0";
}
//"3671";
} else {
$zone_id = "0";
}
$avalue = array();
$adata = array();
for ($i = 0; $i < 10; $i++) {
$adata[] = array(0, 0);
}
$vsql = "select sum(if(timestamp_created >= " . $datemin . ",1,0)) as num, count(*) as total, zone_id\n from {guifi_location}\n where 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)) {
if ($record->total >= 20) {
$vn = $record->num / $record->total * 100;
$vmin = 0;
for ($i = 1; $i < 10; $i++) {
if ($adata[$vmin][1] > $adata[$i][1]) {
$vmin = $i;
}
}
if ($vn > $adata[$vmin][1]) {
$adata[$vmin][0] = $record->zone_id;
$adata[$vmin][1] = $vn;
}
}
}
for ($i = 0; $i < 10; $i++) {
if ($adata[$i][1] != 0) {
$avalue[$adata[$i][0]] = $adata[$i][1];
}
}
arsort($avalue);
foreach ($avalue as $key => $value) {
if ($value != 0) {
$data[] = array(substr(guifi_get_zone_name($key), 0, 20) . " �", $value);
}
}
$shapes = array('none');
$plot = new PHPlot($gwidth, $gheight);
$plot->SetPlotAreaWorld(0, 0, NULL, NULL);
$plot->SetFileFormat('png');
$plot->SetDataType("text-data");
$plot->SetDataValues($data);
$plot->SetPlotType("bars");
$plot->SetXTickIncrement(1);
$plot->SetSkipBottomTick(TRUE);
$plot->SetSkipLeftTick(TRUE);
$plot->SetTickLength(0);
//$plot->SetXTickPos('none');
$plot->SetYDataLabelPos('plotin');
$plot->SetYLabelType('data', 0);
$plot->SetTickColor('grey');
$plot->SetTTFPath($gDirTTFfonts);
$plot->SetFontTTF('title', 'Vera.ttf', 12);
$plot->SetFontTTF('x_label', 'Vera.ttf', 8);
if (isset($_GET['title'])) {
$plot->SetTitle("guifi.net \n" . t($_GET['title']));
} else {
if ($zone_id == "0") {
$plot->SetTitle("guifi.net \n" . t('Largest annual increase'));
} else {
$plot->SetTitle("guifi.net " . t('zone') . ": " . guifi_get_zone_name($zone_id) . "\n" . t('Largest annual increase'));
}
}
//$plot->SetXTitle(t('Zones'));
$plot->SetYTitle(t('% increase'));
$plot->SetXDataLabelPos('plotdown');
//$plot->SetXLabelAngle(45);
$plot->SetXDataLabelAngle(75);
$plot->SetGridColor('red');
$plot->SetPlotBorderType('left');
$plot->SetDataColors(array('orange'));
$plot->SetTextColor('DimGrey');
$plot->SetTitleColor('DimGrey');
$plot->SetLightGridColor('grey');
$plot->SetBackgroundColor('white');
$plot->SetTransparentColor('white');
$plot->SetIsInline(TRUE);
$plot->DrawGraph();
}
示例3: draw
/**
* Adds raw image data of the graph to the output.
* @param $opts FormOptions
*/
public function draw( FormOptions $opts ) {
global $wgTranslatePHPlotFont, $wgLang;
$width = $opts->getValue( 'width' );
$height = $opts->getValue( 'height' );
// Define the object
$plot = new PHPlot( $width, $height );
list( $legend, $resData ) = $this->getData( $opts );
$count = count( $resData );
$skip = intval( $count / ( $width / 60 ) - 1 );
$i = $count;
foreach ( $resData as $date => $edits ) {
if ( $skip > 0 ) {
if ( ( $count - $i ) % $skip !== 0 ) $date = '';
}
if ( strpos( $date, ';' ) !== false ) {
list( , $date ) = explode( ';', $date, 2 );
}
array_unshift( $edits, $date );
$data[] = $edits;
$i--;
}
$font = FCFontFinder::find( $wgLang->getCode() );
if ( $font ) {
$plot->SetDefaultTTFont( $font );
} else {
$plot->SetDefaultTTFont( $wgTranslatePHPlotFont );
}
$plot->SetDataValues( $data );
if ( $legend !== null ) {
$plot->SetLegend( $legend );
}
$numberFont = FCFontFinder::find( 'en' );
$plot->setFont( 'x_label', $numberFont, 8 );
$plot->setFont( 'y_label', $numberFont, 8 );
$yTitle = wfMsg( 'translate-stats-' . $opts['count'] );
// Turn off X axis ticks and labels because they get in the way:
$plot->SetYTitle( $yTitle );
$plot->SetXTickLabelPos( 'none' );
$plot->SetXTickPos( 'none' );
$plot->SetXLabelAngle( 45 );
$max = max( array_map( 'max', $resData ) );
$max = self::roundToSignificant( $max, 1 );
$max = round( $max, intval( -log( $max, 10 ) ) );
$yTick = 10;
while ( $max / $yTick > $height / 20 ) {
$yTick *= 2;
}
// If we have very small case, ensure that there is at least one tick
$yTick = min( $max, $yTick );
$yTick = self::roundToSignificant( $yTick );
$plot->SetYTickIncrement( $yTick );
$plot->SetPlotAreaWorld( null, 0, null, $max );
$plot->SetTransparentColor( 'white' );
$plot->SetBackgroundColor( 'white' );
// Draw it
$plot->DrawGraph();
}
示例4: plot_guifi
function plot_guifi()
{
include drupal_get_path('module', 'guifi') . '/contrib/phplot/phplot.php';
$result = db_query("select COUNT(*) as num, MONTH(FROM_UNIXTIME(timestamp_created)) as mes, YEAR(FROM_UNIXTIME(timestamp_created)) as ano from {guifi_location} where status_flag='Working' GROUP BY YEAR(FROM_UNIXTIME(timestamp_created)),MONTH(FROM_UNIXTIME(timestamp_created)) ");
$inicial = 5;
$nreg = $inicial;
$tot = 0;
$ano = 2004;
$mes = 5;
$items = 2004;
$label = "";
while ($record = db_fetch_object($result)) {
if ($record->ano >= 2004) {
if ($mes == 12) {
$mes = 1;
$ano++;
} else {
$mes++;
}
while ($ano < $record->ano || $mes < $record->mes) {
$nreg++;
if ($mes == 6) {
$label = $ano;
} else {
$label = '';
}
$data[] = array("{$label}", $nreg, $tot, '');
if ($mes == 12) {
$mes = 1;
$ano++;
} else {
$mes++;
}
}
$tot += $record->num;
$nreg++;
if ($mes == 6) {
$label = $ano;
} else {
$label = '';
}
$data[] = array("{$label}", $nreg, $tot, '');
} else {
$tot += $record->num;
}
}
while ($mes < 12) {
$nreg++;
$mes++;
if ($mes == 6) {
$label = $ano;
} else {
$label = '';
}
$data[] = array("{$label}", $nreg, "");
}
$items = ($ano - $items + 1) * 12;
if ($tot % 1000 < 30) {
$data[$nreg - $inicial - 1][3] = $tot;
$vt = floor($tot / 1000) * 1000;
$vtitle = $vt . " " . t('Nodes') . "!!!";
$tcolor = 'red';
} else {
$vtitle = t('Working nodes');
$tcolor = 'DimGrey';
}
$shapes = array('none', 'circle');
$plot = new PHPlot(200, 150);
$plot->SetPlotAreaWorld(0, 0, $items, NULL);
$plot->SetFileFormat('png');
$plot->SetDataType("data-data");
$plot->SetDataValues($data);
$plot->SetPlotType("linepoints");
$plot->SetYTickIncrement(2000);
$plot->SetXTickIncrement(12);
$plot->SetSkipBottomTick(TRUE);
$plot->SetSkipLeftTick(TRUE);
$plot->SetXAxisPosition(0);
$plot->SetPointShapes($shapes);
$plot->SetPointSizes(10);
$plot->SetTickLength(3);
$plot->SetDrawXGrid(TRUE);
$plot->SetTickColor('grey');
$plot->SetTitle($vtitle);
$plot->SetDrawXDataLabelLines(FALSE);
$plot->SetXLabelAngle(0);
$plot->SetXLabelType('custom', 'Plot1_LabelFormat');
$plot->SetGridColor('red');
$plot->SetPlotBorderType('left');
$plot->SetDataColors(array('orange'));
$plot->SetTextColor('DimGrey');
$plot->SetTitleColor($tcolor);
$plot->SetLightGridColor('grey');
$plot->SetBackgroundColor('white');
$plot->SetTransparentColor('white');
$plot->SetXTickLabelPos('none');
$plot->SetXDataLabelPos('plotdown');
$plot->SetIsInline(TRUE);
$plot->DrawGraph();
}
示例5: array
$cumulateddata = array();
$max = 1;
foreach ($stats->getTimestats($term, $REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount']) as $month) {
$bardata[] = array(date('M', mktime(0, 0, 0, $month['m'], 1, 2010)) . "\n" . $month['count'], $month['count']);
if ($month['count'] > $max) {
$max = $month['count'];
}
}
$title = $I18N->Msg('a587_stats_searchterm_timestats_title', empty($term) ? $I18N->Msg('a587_stats_searchterm_timestats_title0_all') : $I18N->Msg('a587_stats_searchterm_timestats_title0_single', $term), intval($_GET['monthcount']));
if (rex_lang_is_utf8()) {
$title = utf8_decode($title);
}
// draw bars
$plot = new PHPlot(700, 240);
$plot->SetImageBorderType('none');
$plot->SetTransparentColor('white');
$plot->SetMarginsPixels(NULL, NULL, 26, NULL);
# Make sure Y axis starts at 0:
$plot->SetPlotAreaWorld(NULL, 0, NULL, NULL);
$len = strlen('' . $max);
$plot->SetYTickIncrement(max(1, ceil($max / pow(10, $len - 1)) * pow(10, $len - 2)));
# Main plot title:
$plot->SetTitle($title);
$plot->SetFont('title', 3);
// draw bars
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($bardata);
$plot->SetDataColors(array('#14568a', '#2c8ce0', '#dfe9e9'));
$plot->SetShading(ceil(48 / $REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount']));
$plot->DrawGraph();