本文整理汇总了PHP中PHPlot::SetXLabelType方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetXLabelType方法的具体用法?PHP PHPlot::SetXLabelType怎么用?PHP PHPlot::SetXLabelType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetXLabelType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plotGraph
function plotGraph($data)
{
//Define the object
$plot = new PHPlot();
$example_data = $data;
$plot->SetDataValues($example_data);
$plot->SetDataType('data-data');
//Set titles
$plot->SetTitle("temp and humi");
$plot->SetXTitle('time');
$plot->SetYTitle('Y Data');
$legend = array('temp', 'humi');
$plot->SetLegend($legend);
$plot->SetXDataLabelAngle(90);
//$plot->SetXGridLabelType("time");
$plot->SetXTickLabelPos('xaxis');
$plot->SetXTickPos('plotdown');
$plot->SetXLabelType('time', '%H:%M');
$plot->TuneXAutoTicks(10, 'date');
// $plot->SetXTickIncrement(.5);
//$plot->SetXTickIncrement(60 * 24);
$plot->SetPlotType('lines');
//$plot->SetPlotAreaWorld(strtotime('00:00'), null, strtotime('23:59'), null);
$plot->SetDrawXGrid(true);
//Draw it
$plot->DrawGraph();
}
示例2: fgetcsv
}
// Read and check the file header.
$row = fgetcsv($f);
if ($row === FALSE || $row[0] != 'Date' || $row[1] != 'Open' || $row[2] != 'High' || $row[3] != 'Low' || $row[4] != 'Close') {
fwrite(STDERR, "Incorrect header in: {$filename}\n");
return FALSE;
}
// Read the rest of the file and convert.
while ($d = fgetcsv($f)) {
$data[] = array('', strtotime($d[0]), $d[1], $d[2], $d[3], $d[4]);
}
fclose($f);
return $data;
}
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
// Improves presentation in the manual
$plot->SetTitle("Candlesticks Financial Plot (data-data)\nMSFT Q1 2009");
$plot->SetDataType('data-data');
$plot->SetDataValues(read_prices_data_data(DATAFILE));
$plot->SetPlotType('candlesticks');
$plot->SetDataColors(array('SlateBlue', 'black', 'SlateBlue', 'black'));
$plot->SetXLabelAngle(90);
$plot->SetXLabelType('time', '%Y-%m-%d');
$plot->SetXTickIncrement(7 * 24 * 60 * 60);
// 1 week interval
if (method_exists($plot, 'TuneYAutoRange')) {
$plot->TuneYAutoRange(0);
}
// Suppress Y zero magnet (PHPlot >= 6.0.0)
$plot->DrawGraph();
示例3: PHPlot
$prevDay = $mkday;
$prevDOfMonth = $DayOfMonth;
}
if ($debug) {
print_r($allDays);
}
if ($debug) {
print "I" . $maxValue . "I";
}
include "../include/phplot/phplot.php";
$graph = new PHPlot(600, 300);
$graph->SetDataType("text-data");
$graph->SetDataValues($allDays);
$graph->SetYTickIncrement();
$graph->y_tick_increment = ceil(@$graph->y_tick_increment);
$graph->SetXLabelType("time");
$graph->SetXTimeFormat("%b %d");
if ($incoming == '2') {
$graph->SetLegend(array("Outgoing"));
$graph->SetDataColors(array('green'));
} elseif ($incoming == '3') {
$graph->SetLegend(array("Incoming"));
$graph->SetDataColors(array('orange'));
} else {
$graph->SetLegend(array("All", "Outgoing", "Incoming"));
}
$graph->SetYTitle("Quantity of calls");
$graph->SetPlotType("bars");
$graph->SetXLabelAngle(90);
// Turn off X tick labels and ticks because they don't apply here:
$graph->SetXTickLabelPos('none');
示例4: PHPlot
$range = "{$xmin} : {$xmax}";
}
$title = "Date/time X Auto-Range Test: [{$range}]";
if (isset($mintick)) {
$title .= "\nX Min Ticks = {$mintick}";
}
if (isset($xtickinc)) {
$title .= "\nX Tick Increment = {$xtickinc}";
}
if (isset($tickanchor)) {
$title .= "\nX Tick Anchor = {$tickanchor}";
}
$p = new PHPlot(800, 800);
$p->SetTitle($title);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetPlotType('lines');
# Format labels as date/time:
$p->SetXLabelType('time', $dtformat);
$p->SetXLabelAngle(90);
if (isset($mintick)) {
$p->TuneXAutoTicks($mintick);
}
if (isset($tickanchor)) {
$p->SetXTickAnchor($tickanchor);
}
if (isset($xtickinc)) {
$p->SetXTickIncrement($xtickinc);
}
$p->DrawGraph();
示例5: cos
# Y2 = cos(x)
$end = M_PI * 2.0;
$delta = $end / 20.0;
$data = array();
for ($x = 0; $x <= $end; $x += $delta) {
$data[] = array('', $x, sin($x), cos($x));
}
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('lines');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('Line Plot, Sin and Cos');
# Make a legend for the 2 functions:
$plot->SetLegend(array('sin(t)', 'cos(t)'));
# Select a plot area and force ticks to nice values:
$plot->SetPlotAreaWorld(0, -1, 6.8, 1);
# Even though the data labels are empty, with numeric formatting they
# will be output as zeros unless we turn them off:
$plot->SetXDataLabelPos('none');
$plot->SetXTickIncrement(M_PI / 8.0);
$plot->SetXLabelType('data');
$plot->SetPrecisionX(3);
$plot->SetYTickIncrement(0.2);
$plot->SetYLabelType('data');
$plot->SetPrecisionY(1);
# Draw both grids:
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
$plot->DrawGraph();
示例6: array
$data = array(array('', -1000, 1000), array('', -500, 23456), array('', 0, 800), array('', 500, 234100), array('', 1000, 1234567), array('', 1500, 100000), array('', 2000, 1901000), array('', 2500, 999999));
$title = "Test Attribute Resets:\n";
if (empty($test_resets)) {
$title .= 'Baseline - red border, formatted labels';
} else {
$title .= 'Reset to no border, no label formatting';
}
$plot = new PHPlot(400, 400);
$plot->SetTitle($title);
$plot->SetPlotType('lines');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
$plot->SetPlotAreaWorld(-1000, 0);
$plot->SetXDataLabelPos('none');
$plot->SetXTickIncrement(500);
$plot->SetXLabelType('data', 0, '', 'M');
$plot->SetYTickIncrement(200000);
$plot->SetYLabelType('data', 2);
$plot->SetImageBorderType('raised');
$plot->SetImageBorderColor('red');
$plot->SetDrawXGrid(False);
$plot->SetDrawYGrid(False);
# Set $test_resets=True and include this file to test resets:
if (!empty($test_resets)) {
# Reset to no border:
$plot->SetImageBorderType('none');
# Reset X to no formatting using empty string:
$plot->SetXLabelType('');
# Reset Y to no formatting using no argument:
$plot->SetYLabelType();
}
示例7: 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();
}
示例8: array
<?php
# $Id$
# Test types of label formatting 4 (time, data:0:prefix+suffix)
require_once 'phplot.php';
$data = array();
$t = mktime(12, 0, 0, 6, 1, 2000);
for ($i = 0; $i < 12; $i++) {
$data[] = array('', $t, $i * 13.4);
$t += 60 * 60 * 24;
}
$p = new PHPlot(800, 600);
$p->SetTitle("Label Format 4");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(60 * 60 * 24);
$p->SetYTickIncrement(10);
$p->SetPlotType('lines');
$p->SetXLabelType('time', '%m/%d');
$p->SetXTitle("X: time MM/DD");
$p->SetYLabelType('data', 0, '$', '#');
$p->SetYTitle("Y: data, prec=0, prefix=\$, suffix=#");
$p->DrawGraph();
#fwrite(STDERR, print_r($p, True));
示例9: 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();
}
示例10: my_format
<?php
# $Id$
# Test types of label formatting 2 (custom, data:3)
require_once 'phplot.php';
function my_format($val, $arg)
{
$m = (int) ($val / 60);
$h = (int) ($m / 60);
$m %= 60;
return sprintf("%dH%dM", $h, $m);
}
$data = array();
for ($i = 0; $i < 10; $i++) {
$data[] = array('', 4000 * $i, 1234 * $i);
}
$p = new PHPlot(800, 600);
$p->SetTitle("Label Format Test 2");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(2000);
$p->SetYTickIncrement(1000);
$p->SetPlotType('lines');
$p->SetXLabelType('custom', 'my_format');
$p->SetXTitle("X: custom H:M");
$p->SetYLabelType('data', 3);
$p->SetYTitle("Y: data, prec=3");
$p->DrawGraph();
示例11: array
<?php
# $Id$
# Test types of label formatting 1 (data:2, printf:%e)
require_once 'phplot.php';
$data = array();
for ($i = 0; $i < 10; $i++) {
$data[] = array('', 500 * $i, 1234 * $i);
}
$p = new PHPlot(800, 600);
$p->SetTitle("Label Format Test 1");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1000);
$p->SetYTickIncrement(1000);
$p->SetPlotType('lines');
$p->SetXTitle("X: data, prec=2");
$p->SetXLabelType('data', 2);
$p->SetYTitle("Y: printf %8.2e");
$p->SetYLabelType('printf', '%8.2e');
$p->DrawGraph();
示例12: PHPlot
// Common setup:
$plot = new PHPlot(460, 600);
$plot->SetPrintImage(False);
$plot->SetTitle("Multiple Plots, X,Y label format\n{$subtitle}");
$plot->SetPlotType('linepoints');
$plot->SetDataValues($data);
$plot->SetDataType('data-data');
$plot->SetYDataLabelPos('plotin');
// Enable both X tick and X data labels, but with data labels above.
$plot->SetXDataLabelPos('plotup');
$plot->SetXTickLabelPos('plotdown');
$plot->SetPlotBorderType('full');
// Plot #1:
$plot->SetPlotAreaPixels(NULL, 80, NULL, 305);
if (isset($fmt[1]['x'])) {
$plot->SetXLabelType('printf', $fmt[1]['x']);
}
if (isset($fmt[1]['y'])) {
$plot->SetYLabelType('printf', $fmt[1]['y']);
}
if (isset($fmt[1]['xd'])) {
$plot->SetXDataLabelType('printf', $fmt[1]['xd']);
}
if (isset($fmt[1]['yd'])) {
$plot->SetYDataLabelType('printf', $fmt[1]['yd']);
}
$plot->DrawGraph();
// Plot #2:
$plot->SetPlotAreaPixels(NULL, 345, NULL, 570);
if (isset($fmt[2]['x'])) {
$plot->SetXLabelType('printf', $fmt[2]['x']);
示例13: PHPlot
$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();
示例14:
$p->SetYDataLabelPos('plotin');
}
$p->SetPlotAreaWorld(NULL, 0, NULL, 109);
# Use this TrueType font and make labels bigger:
$p->SetDefaultTTFont($phplot_test_ttfdir . $phplot_test_ttfonts['sans']);
$p->SetFont('x_label', '', 10);
$p->SetFont('y_label', '', 10);
# Options: X
if (isset($tp['x_angle'])) {
$p->SetXLabelAngle($tp['x_angle']);
}
if (isset($tp['xd_angle'])) {
$p->SetXDataLabelAngle($tp['xd_angle']);
}
if (isset($tp['x_type'])) {
$p->SetXLabelType($tp['x_type'], $tp['x_type_arg']);
}
if (isset($tp['xd_type'])) {
$p->SetXDataLabelType($tp['xd_type'], $tp['xd_type_arg']);
}
if (isset($tp['xt_pos'])) {
$p->SetXTickLabelPos($tp['xt_pos']);
}
if (isset($tp['xd_pos'])) {
$p->SetXDataLabelPos($tp['xd_pos']);
}
# Options: Y
if (isset($tp['y_angle'])) {
$p->SetYLabelAngle($tp['y_angle']);
}
if (isset($tp['yd_angle'])) {
示例15: array
<?php
# $Id$
# Test types of label formatting 5 - obsolete data_units_text
require_once 'phplot.php';
require_once 'config.php';
// Uses TTF for variety
$data = array();
for ($i = 0; $i < 10; $i++) {
$data[] = array('', 500 * $i, 1234 * $i);
}
$p = new PHPlot(800, 600);
$p->SetDefaultTTFont($phplot_test_ttfdir . $phplot_test_ttfonts['serif']);
$p->SetTitle("Label Format 5 with data_units_text=% suffix (obso)");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1000);
$p->SetYTickIncrement(1000);
# Make the labels bigger:
$p->SetFont('x_label', '', 9);
$p->SetFont('y_label', '', 9);
$p->SetPlotType('lines');
$p->data_units_text = '%';
$p->SetXLabelType('data', 1, '', '#');
$p->SetXTitle('X: data(prec=1), suffix=# and %');
$p->SetYLabelType('data', 1);
$p->SetYTitle('Y: data(prec=1), suffix=%');
$p->DrawGraph();
#fwrite(STDERR, print_r($p, True));