本文整理汇总了PHP中PHPlot::SetPointShapes方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetPointShapes方法的具体用法?PHP PHPlot::SetPointShapes怎么用?PHP PHPlot::SetPointShapes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetPointShapes方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
# Testing phplot - Line-Points, extensions to suppress either
# the line or the points on each plot.
# $Id$
require_once 'phplot.php';
$data = array(array('', 1, 1, 2, 3), array('', 2, 2, 3, 4), array('', 3, 3, 4, 5), array('', 4, 4, 5, 6), array('', 5, 5, 6, 7), array('', 6, 6, 7, 8), array('', 7, 7, 8, 9), array('', 8, 8, 9, 10), array('', 9, 9, 10, 11), array('', 10, 10, 11, 12));
$p = new PHPlot();
$p->SetTitle('PlotType: linepoints with suppression');
$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.
# Increase X range to make room for the legend.
$p->SetPlotAreaWorld(0, 0, 13, 20);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(2);
$p->SetDataColors(array('red', 'green', 'blue'));
$p->SetPointShapes(array('circle', 'none', 'diamond'));
$p->SetLineStyles(array('solid', 'solid', 'none'));
$p->SetLegend(array('circle+line', 'line only', 'diamond only'));
# Make the points bigger so we can see them:
$p->SetPointSizes(10);
# Draw both grids:
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
# The default
$p->SetPlotType('linepoints');
$p->DrawGraph();
示例2: array
# Testing phplot - Points
require_once 'phplot.php';
# This array is used for both the point shapes and legend:
$shapes = array('circle', 'cross', 'diamond', 'dot', 'halfline', 'line', 'plus', 'rect', 'triangle', 'trianglemid');
# 10 lines, one for each shape:
$data = array(array('', 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array('', 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), array('', 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), array('', 4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), array('', 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14), array('', 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), array('', 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), array('', 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), array('', 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18), array('', 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19));
$p = new PHPlot();
$p->SetTitle('Points plots, 10 lines/10 shapes');
$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.
# Increase X range to make room for the legend.
$p->SetPlotAreaWorld(0, 0, 13, 20);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(2);
# Need 10 different colors; defaults are not different:
$p->SetDataColors(array('red', 'green', 'blue', 'yellow', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'orange'));
# Show all 10 shapes:
$p->SetPointShapes($shapes);
# Also show that as the legend:
$p->SetLegend($shapes);
# Make the points bigger so we can see them:
$p->SetPointSizes(10);
# Draw both grids:
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
# The default
$p->SetPlotType('points');
$p->DrawGraph();
示例3: SetDataColors
# $data_colors = color array for SetDataColors()
# $line_widths = line widths array for SetLineWidths()
# $subtitle = Text below the main title
# $point_shape and $point_size (single values) for outliers.
require_once 'phplot.php';
if (empty($subtitle)) {
$subtitle = 'Baseline';
}
$data = array(array("No\nOutliers", 20, 22, 25, 30, 35), array("1\nOutlier", 30, 32, 35, 40, 45, 5), array("2\nOutliers", 40, 42, 45, 50, 55, 10, 60), array("3\nOutliers", 10, 20, 30, 40, 50, 9, 8, 52), array("4\nOutliers", 10, 20, 30, 40, 50, 4, 7, 80, 70), array("1 val\nAAAAA", 50, 50, 50, 50, 50), array("2 val\nAAAAB", 40, 40, 40, 40, 60), array("2 val\nAAABB", 40, 40, 40, 60, 60), array("2 val\nAABBB", 40, 40, 60, 60, 60), array("2 val\nABBBB", 40, 60, 60, 60, 60), array("3 val\nAAABC", 50, 50, 50, 60, 70), array("3 val\nAABBC", 20, 20, 50, 50, 70), array("3 val\nAABCC", 20, 20, 50, 70, 70), array("3 val\nABBBC", 20, 50, 50, 50, 70), array("3 val\nABBCC", 20, 50, 50, 70, 70), array("3 val\nABCCC", 20, 30, 50, 50, 50), array("4 val\nAABCD", 30, 30, 50, 60, 70), array("4 val\nABBCD", 30, 50, 50, 60, 70), array("4 val\nABCCD", 30, 40, 50, 50, 70), array("4 val\nABCDD", 30, 40, 50, 70, 70));
$p = new PHPlot(900, 600);
$p->SetTitle("Box Plot with Various Data Cases\n{$subtitle}");
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotAreaWorld(NULL, 0, NULL, 100);
$p->SetDrawYGrid(False);
$p->SetPlotType('boxes');
$p->SetXTickPos('none');
# Optional style controls:
if (isset($data_colors)) {
$p->SetDataColors($data_colors);
}
if (isset($line_widths)) {
$p->SetLineWidths($line_widths);
}
if (isset($point_shape)) {
$p->SetPointShapes($point_shape);
}
if (isset($point_size)) {
$p->SetPointSize($point_size);
}
$p->DrawGraph();
示例4: guifi_stats_chart05
//.........这里部分代码省略.........
} else {
$tot = $record->num;
}
$tot2 = fmediacalc($tot, $datos, $n, $nmonths);
$data[] = array("{$label}", $nreg, $tot2);
if (floor($tot2) > $max) {
$max = floor($tot2);
}
if ($mes == 12) {
$mes = 1;
$ano++;
} else {
$mes++;
}
}
$tot += $record->num;
$nreg++;
if ($mes == 6) {
$label = $ano;
} else {
$label = '';
}
if ($n == 0) {
$tot += $record->num;
} else {
$tot = $record->num;
}
$tot2 = fmediacalc($tot, $datos, $n, $nmonths);
$data[] = array("{$label}", $nreg, $tot2);
if (floor($tot2) > $max) {
$max = floor($tot2);
}
} else {
$tot += $record->num;
}
}
while ($mes < 12) {
$nreg++;
$mes++;
if ($mes == 6) {
$label = $ano;
} else {
$label = '';
}
$data[] = array("{$label}", $nreg, "");
}
if ($tot <= 10) {
$inc = 1;
} else {
$vlen = strlen($max);
$vini = substr($max, 0, 1);
$inc = str_pad($vini, $vlen - 1, "0");
}
$items = ($ano - $items + 1) * 12;
$shapes = array('none');
$plot = new PHPlot($gwidth, $gheight);
$plot->SetPlotAreaWorld(0, 0, $items, NULL);
$plot->SetFileFormat('png');
$plot->SetDataType("data-data");
$plot->SetDataValues($data);
$plot->SetPlotType("linepoints");
$plot->SetYTickIncrement($inc);
$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->SetTTFPath($gDirTTFfonts);
$plot->SetFontTTF('title', 'Vera.ttf', 12);
if (isset($_GET['title'])) {
$plot->SetTitle("guifi.net \n" . t($_GET['title']));
} else {
if ($zone_id == "0") {
$plot->SetTitle("guifi.net \n" . t('Nodes per month, ' . "{$nmonths}" . ' months average'));
} else {
$plot->SetTitle("guifi.net " . t('zone') . ": " . guifi_get_zone_name($zone_id) . "\n" . t('Nodes per month, ' . "{$nmonths}" . ' months average'));
}
}
$plot->SetXTitle(t('Years'));
$plot->SetYTitle(t('Working nodes'));
$plot->SetDrawXDataLabelLines(FALSE);
$plot->SetXLabelAngle(0);
$plot->SetXLabelType('custom', 'guifi_stats_chart05_LabelFormat');
$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->SetXTickLabelPos('none');
$plot->SetXDataLabelPos('plotdown');
$plot->SetIsInline(TRUE);
$plot->DrawGraph();
}
示例5: 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();
}
示例6: is
<?php
# PHPlot Example - Box Plot with outliers and line styles
require_once 'phplot.php';
# Data array: each row is (label, X, Ymin, YQ1, Ymid, YQ3, Ymax, [Youtlier...])
$data = array(array('', 1, 10, 15, 20, 25, 30), array('', 2, 12, 14, 18, 20, 24, 6, 8, 28), array('', 3, 5, 11, 19, 28, 35), array('', 4, 14, 17, 21, 26, 28, 9, 12, 35, 32), array('', 5, 12, 15, 22, 27, 30), array('', 6, 15, 18, 20, 22, 26, 12), array('', 7, 10, 15, 21, 26, 28, 32), array('', 8, 11, 15, 20, 24, 27, 6, 8), array('', 9, 10, 15, 19, 22, 26, 4, 34));
$plot = new PHPlot(800, 600);
$plot->SetTitle('Box Plot with outliers and styles');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
$plot->SetPlotType('boxes');
$plot->SetImageBorderType('plain');
// Improves presentation in the manual
# Use dashed lines for the upper and lower whiskers:
$plot->SetLineStyles('dashed');
# Make the box and belt use a thicker line:
$plot->SetLineWidths(array(3, 3, 1));
# Make the outliers red, and everything else blue:
$plot->SetDataColors(array('blue', 'blue', 'red', 'blue'));
# Draw the outliers using a "star":
$plot->SetPointShapes('star');
$plot->DrawGraph();
示例7: urldecode
<?php
require '../src/php_lot/phplot.php';
if (isset($_GET['data'], $_GET['sigla'], $_GET['ano'])) {
$data = urldecode($_GET['data']);
$data = stripslashes($data);
$data = unserialize($data);
$ano = $_GET['ano'];
$sigla = $_GET['sigla'];
$show;
$Ymin = min($data);
foreach ($data as $k => $d) {
$show[] = array($k, (int) $d);
}
//var_dump($show);
$plot = new PHPlot(800, 400);
$plot->SetDataValues($show);
$plot->SetDataType('text-data');
//$plot->SetTitle("");
$plot->SetXTitle("Meses de " . $ano . " - " . $sigla);
//$plot->SetNumYTicks(8);
$plot->SetPointShapes('dot');
$plot->SetPointSizes(10);
$plot->SetPlotAreaWorld(NULL, $Ymin);
$plot->SetYTitle("Valor Pago (R\$)");
$plot->DrawGraph();
}
示例8: PHPlot
}
$data[] = $subdata;
}
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('linepoints');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('Linepoints Plot - All Point Shapes');
# Increase X range to make room for the legend.
$plot->SetPlotAreaWorld(0, 0, $ppl, $n_shapes + $ppl - 2);
# Turn off tick labels and ticks - not used for this plot.
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYTickLabelPos('none');
$plot->SetYTickPos('none');
# Need some different colors;
$plot->SetDataColors(array('orange', 'blue', 'maroon', 'red', 'peru', 'cyan', 'black', 'gold', 'purple', 'YellowGreen', 'SkyBlue', 'green', 'SlateBlue', 'navy', 'aquamarine1', 'violet', 'salmon', 'brown', 'pink', 'DimGrey'));
# Show all shapes:
$plot->SetPointShapes($shapes);
# Make the points bigger so we can see them:
$plot->SetPointSizes(10);
# Make the lines all be solid:
$plot->SetLineStyles('solid');
# Also show that as the legend:
$plot->SetLegend($shapes);
# Draw no grids:
$plot->SetDrawXGrid(False);
$plot->SetDrawYGrid(False);
$plot->DrawGraph();
示例9: makePngGraph
/**
* Generate a graph for this tag
* @param string $tag
* @param string $filePath
* @return bool, success
*/
public function makePngGraph( $tag, $filePath ) {
if( !function_exists( 'ImageCreate' ) ) {
// GD is not installed
return false;
}
global $wgPHPlotDir, $wgMemc;
require_once( "$wgPHPlotDir/phplot.php" ); // load classes
// Define the object
$plot = new PHPlot( 1000, 400 );
// Set file path
$dir = dirname($filePath);
// Make sure directory exists
if( !file_exists($dir) && !wfMkdirParents( $dir, 0777, __METHOD__ ) ) {
throw new MWException( 'Could not create file directory!' );
}
$plot->SetOutputFile( $filePath );
$plot->SetIsInline( true );
$data = array();
$totalVal = $totalCount = $n = 0;
// Define the data using the DB rows
list($res,$u,$maxC,$days) = $this->doQuery( $tag );
if( !$maxC ) {
return false;
}
// Label spacing
$int = intval( ceil($days/10) ); // 10 labels at most
foreach( $res as $row ) {
$totalVal += (int)$row->rfh_total;
$totalCount += (int)$row->rfh_count;
$dayCount = (real)$row->rfh_count;
if( !$row->rfh_count ) {
continue; // bad data
}
// Nudge values up by 1
$dayAve = 1 + (real)$row->rfh_total/(real)$row->rfh_count;
$cumAve = 1 + (real)$totalVal/(real)$totalCount;
$year = intval( substr( $row->rfh_date, 0, 4 ) );
$month = intval( substr( $row->rfh_date, 4, 2 ) );
$day = intval( substr( $row->rfh_date, 6, 2 ) );
# Fill in days with no votes to keep spacing even
if( isset($lastDate) ) {
$dayGap = wfTimestamp(TS_UNIX,$row->rfh_date) - wfTimestamp(TS_UNIX,$lastDate);
$x = intval( $dayGap/86400 );
# Day gaps...
for( $x; $x > 1; --$x ) {
$data[] = array("",$lastDAve,$lastRAve,0);
$n++;
}
}
$n++;
# Label point?
if( $n >= $int || !count($data) ) {
$p = ($days > 31) ? "{$month}-".substr( $year, 2, 2 ) : "{$month}/{$day}";
$n = 0;
} else {
$p = "";
}
$data[] = array( $p, $dayAve, $cumAve, $dayCount );
$lastDate = $row->rfh_date;
$lastDAve = $dayAve;
$lastRAve = $cumAve;
}
// Minimum sample size
if( count($data) < 2 ) {
return false;
}
// Re-scale voter count to fit to graph
$this->dScale = ceil($maxC/5);
// Cache the scale value to memory
$key = wfMemcKey( 'feedback', 'scale', $this->page->getArticleId(), $this->period );
$wgMemc->set( $key, $this->dScale, 7*24*3600 );
// Fit to [0,4]
foreach( $data as $x => $dataRow ) {
$data[$x][3] = $dataRow[3]/$this->dScale;
}
$plot->SetDataValues($data);
$plot->SetPointShapes( array('dot','dot','dot') );
$plot->setPointSizes( array(1,1,4) );
$plot->SetDataColors( array('blue','green','red') );
$plot->SetLineStyles( array('solid','solid','solid') );
$plot->SetBackgroundColor('#F8F8F8');
// Turn off X axis ticks and labels because they get in the way:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYTickIncrement( .5 );
// Set plot area
$plot->SetPlotAreaWorld( 0, 0, null, 5 );
// Show total number of votes
$plot->SetLegend( array("#{$totalCount}") );
// Draw it!
$plot->DrawGraph();
return true;
}