本文整理汇总了PHP中PHPlot::SetPlotAreaPixels方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetPlotAreaPixels方法的具体用法?PHP PHPlot::SetPlotAreaPixels怎么用?PHP PHPlot::SetPlotAreaPixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetPlotAreaPixels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
# $Id$
# PHPlot Example: Two plots on one image
require_once 'phplot.php';
$data1 = array(array('1981', 5996), array('1982', 5113), array('1983', 5051), array('1984', 5437), array('1985', 5067), array('1986', 6224), array('1987', 6678), array('1988', 7402), array('1989', 8061), array('1990', 8018), array('1991', 7627), array('1992', 7888), array('1993', 8620), array('1994', 8996), array('1995', 8835), array('1996', 9478), array('1997', 10162), array('1998', 10708), array('1999', 10852), array('2000', 11459));
$data2 = array(array('1981', 595), array('1982', 815), array('1983', 739), array('1984', 722), array('1985', 781), array('1986', 785), array('1987', 764), array('1988', 815), array('1989', 859), array('1990', 857), array('1991', 1001), array('1992', 950), array('1993', 1003), array('1994', 942), array('1995', 949), array('1996', 981), array('1997', 1003), array('1998', 945), array('1999', 940), array('2000', 1040));
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
# Disable auto-output:
$plot->SetPrintImage(0);
# There is only one title: it is outside both plot areas.
$plot->SetTitle('US Petroleum Import/Export');
# Set up area for first plot:
$plot->SetPlotAreaPixels(80, 40, 740, 350);
# Do the first plot:
$plot->SetDataType('text-data');
$plot->SetDataValues($data1);
$plot->SetPlotAreaWorld(NULL, 0, NULL, 13000);
$plot->SetDataColors(array('blue'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYTickIncrement(1000);
$plot->SetYTitle("IMPORTS\n1000 barrels/day");
$plot->SetPlotType('bars');
$plot->DrawGraph();
# Set up area for second plot:
$plot->SetPlotAreaPixels(80, 400, 740, 550);
# Do the second plot:
$plot->SetDataType('text-data');
$plot->SetDataValues($data2);
示例2: PHPlot
foreach ($data as $row) {
$legend[] = $row[0] . ' = ' . $row[1];
}
# Common setup for all plots on the image:
$plot = new PHPlot(800, 625);
$plot->SetTitle('Multiple pie charts');
$plot->SetPrintImage(False);
$plot->SetBackgroundColor('wheat');
$plot->SetDrawPlotAreaBackground(True);
$plot->SetPlotType('pie');
$plot->SetDataType($data_type);
$plot->SetDataValues($data);
$plot->SetPlotBorderType('full');
#$plot->SetLabelScalePosition(0.50);
# Plot 1 - upper left
$plot->SetPlotAreaPixels(4, 25, 398, 323);
$plot->SetPieLabelType('label');
$plot->SetPlotBgColor('plum');
$plot->DrawGraph();
# Plot 2 - upper right
$plot->SetPlotAreaPixels(402, 25, 797, 323);
$plot->SetPieLabelType('index');
$plot->SetPlotBgColor('salmon');
$plot->DrawGraph();
# Plot 3 - lower left
$plot->SetPlotAreaPixels(4, 327, 398, 623);
$plot->SetPieLabelType('');
// Reset to default
$plot->SetDrawPlotAreaBackground(False);
$plot->DrawGraph();
# Plot 4 - lower right
示例3: array
# A TrueType font to use:
$font = $phplot_test_ttfdir . $phplot_test_ttfonts['sansbold'];
extract($tp);
// Import test parameters
$data = array(array('', 0, 0, 0, 0), array('', 1, 1, 2, 3), array('', 2, 2, 4, 6), array('', 3, 3, 6, 9));
$legend = array('Plot Line 1', 'Longer label for Plot Line 2', 'line 3');
$p = new PHPlot(800, 600);
if (!empty($title)) {
// $title can be set empty for special case
if (!empty($suffix)) {
$title .= "\n" . $suffix;
}
$p->SetTitle($title);
}
// Use smaller window, offset, so legend position is more apparent.
$p->SetPlotAreaPixels(100, 80, 700, 480);
$p->SetLegend($legend);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('lines');
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(1.0);
$p->SetDrawXGrid(True);
if (isset($ttfontsize)) {
$p->SetFontTTF('legend', $font, $ttfontsize, $ttlinespace);
}
if (isset($relto)) {
$p->SetLegendPosition($lx, $ly, $relto, $bx, $by, $ox, $oy);
}
if (isset($callback)) {
示例4: array
# This is a cubic equation with roots at -8, 2, 10
for ($x = -10; $x <= 10; $x++) {
$data[] = array('', $x, ($x + 8) * ($x - 2) * ($x - 10));
}
$p = new PHPlot(400, 800);
$p->SetPrintImage(FALSE);
$p->SetPlotBorderType('full');
$p->SetTitle("Set/Reset Parameters Test (2)\n" . "Top: Parameters Set\n" . "Bottom: Parameters Reset");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('lines');
$p->SetLegend('Y = F(X)');
$p->SetLegendPixels(100, 200);
$p->SetNumXTicks(5);
$p->SetNumYTicks(8);
$p->SetXTitle('X Axis with 5 ticks');
$p->SetYTitle('Y Axis with 8 ticks');
$p->SetXAxisPosition(-228);
$p->SetYAxisPosition(7);
$p->SetPlotAreaPixels(70, 80, 380, 400);
$p->DrawGraph();
$p->SetLegendPixels();
$p->SetNumXTicks();
$p->SetNumYTicks();
$p->SetXTitle('X Axis');
$p->SetYTitle('Y Axis');
$p->SetXAxisPosition();
$p->SetYAxisPosition();
$p->SetPlotAreaPixels(70, 450, 380, 750);
$p->DrawGraph();
$p->PrintImage();
示例5: array
# Based on a posting 2010-07-16 to PHPlot forum
require_once 'phplot.php';
// First data array for Left axis graph:
$data1 = array(array('', 0, 20), array('', 1, 15), array('', 2, 8), array('', 3, 6), array('', 4, 3), array('', 5, 7), array('', 6, 14), array('', 7, 28), array('', 8, 32), array('', 9, 35));
// Second data array for Right axis graph:
$data2 = array(array('', 0, 17), array('', 1, 22), array('', 2, 30), array('', 3, 36), array('', 4, 49), array('', 5, 57), array('', 6, 67), array('', 7, 73), array('', 8, 78), array('', 9, 81));
$p = new PHPlot(800, 600);
$p->SetPrintImage(0);
// Do not output image until told
// First plot:
$p->SetDataValues($data1);
$p->SetDataType('data-data');
$p->SetPlotType('lines');
$p->SetPlotAreaWorld(NULL, 0, NULL, NULL);
// Force Y to start at 0
$p->SetPlotAreaPixels(60, 40, 740, 560);
// Force same window for both plots
$p->SetYTickPos('plotleft');
// The default
$p->SetYTickLabelPos('plotleft');
// The default
$p->SetXTickIncrement(1);
$p->SetDataColors('blue');
// Force data color
$p->SetTitle('Overlay Line Plots to get Different Y Scales');
$p->SetTitleColor('black');
$p->SetXTitle('X Axis Title');
$p->SetYTitle('Temperature', 'plotleft');
$p->SetYTitleColor('blue');
$p->DrawGraph();
// Second plot:
示例6: array
<?php
# $Id$
# Testing phplot - Fix for SetPlotAreaPixels with pie charts.
require_once 'phplot.php';
$data = array();
$legend = array();
for ($i = 0; $i < 15; $i++) {
$data[] = array('', 10 + $i);
$legend[] = "A very long label for set {$i}";
}
$p = new PHPlot(800, 500);
$p->SetPlotAreaPixels(240, 20, 795, 495);
$p->SetLegendPixels(5, 40);
$p->SetLegend($legend);
$p->SetTitle("Pie chart, SetPlotAreaPixels, Long Labels");
$p->SetDataType('text-data-single');
$p->SetDataValues($data);
$p->SetPlotType('pie');
# Color background so we can see what's what:
$p->SetDrawPlotAreaBackground(True);
$p->SetPlotBgColor('gray');
$p->DrawGraph();
示例7: foreach
$graph->SetShading(0);
$graph->SetPlotAreaWorld(NULL, 0);
}
if (count($stat['legend']) > 0) {
foreach ($stat['legend'] as $key => $val) {
if (strlen($val) > 23) {
$stat['legend'][$key] = substr($val, 0, 20) . '...';
}
}
$graph->SetLegend($stat['legend']);
}
if ($stat['legend_x'] && $stat['legend_y']) {
$graph->SetLegendPixels($stat['legend_x'], $stat['legend_y']);
}
if ($stat['graphtype'] == 'pie') {
$graph->SetPlotAreaPixels(150, 0, $stat['xsize'], $stat['ysize']);
$graph->SetLegendPixels(1, 30);
$graph->SetShading(0);
if ($stype == 'experience_avg_experimentclass') {
$graph->SetPieLabelType('value');
}
}
$graph->SetTitle($stat['title']);
if ($stat['xtitle']) {
$graph->SetXTitle($stat['xtitle'], 'plotdown');
}
// plotup, plotdown, both, none
if ($stat['ytitle']) {
$graph->SetYTitle($stat['ytitle'], 'plotleft');
}
// plotleft, plotright, both, plotin, none
示例8: PHPlot
include "/usr/lib/phplot/phplot.php";
include "/usr/lib/phplot/rgb.inc.php";
include "/tmp/plot.data.php";
// Test data
//$cvs_data = array(
// array( "", "2000/03/15", 750),
// array("", "2010/04/18", 1700),
// array("", "2015/05/19", 2000),
// array("", "2030/06/20", 400)
// );
$graph = new PHPlot(238, 220);
$graph->SetIsInline("1");
$graph->SetDataType("text-data");
$graph->SetPlotType("bars");
$graph->SetDataValues($cvs_data);
// Specify plotting area details
$graph->SetImageArea(238, 220);
$graph->SetPlotAreaPixels(55, 20, 208, 190);
$graph->SetPrecisionY("0");
$graph->SetVertTickIncrement("100");
$graph->SetTickLength("5");
$graph->SetTitleFontSize("2");
$graph->SetPlotBgColor(204, 204, 204);
$graph->SetPlotBorderType("left");
$graph->SetBackgroundColor($ColorArray["gray80"]);
// Define the X axis
$graph->SetXLabel("Date");
// Define the Y axis
$graph->SetDataColors(array("blue", "red"), array("black"));
$graph->SetFileFormat("png");
$graph->DrawGraph();
示例9: sdc
# no-callback behavior, but presence of a callback changes
# how colors are allocated.
function sdc($img, $unused, $row, $col)
{
return $col;
}
$title = "Multiplot vs data colors, type {$plot_type}";
$p = new PHPlot(800, 800);
if ($do_callback) {
$p->SetCallback('data_color', 'sdc');
$title .= ", with data_color callback";
}
$p->SetPrintImage(False);
$p->SetTitle($title);
$p->SetPlotType($plot_type);
$p->SetLineStyles('solid');
$p->SetDataType('text-data');
$p->SetPlotAreaWorld(0, 0, 4, 10);
$p->SetPlotAreaPixels(60, 60, 339, 339);
$p->SetDataValues($data3);
$p->DrawGraph();
$p->SetPlotAreaPixels(460, 60, 739, 339);
$p->SetDataValues($data2);
$p->DrawGraph();
$p->SetPlotAreaPixels(60, 460, 339, 739);
$p->SetDataValues($data3);
$p->DrawGraph();
$p->SetPlotAreaPixels(460, 460, 739, 739);
$p->SetDataValues($data2);
$p->DrawGraph();
$p->PrintImage();
示例10: Y
$plot->SetXTickPos('none');
$plot->SetXDataLabelPos('none');
$plot->SetPrintImage(False);
$plot->SetImageBorderType('solid');
# Sub-plot area limits for Y (in pixels):
$py1 = 55;
$py2 = 355;
# Pixel limits for X:
$pdx = 195;
// Approx plot_width / 4 sub-plots
$px_l = 40;
// Left offset
$px_r = 5;
// Right inset
# Sub-plot (1) shows the initial plot range = date range.
$plot->SetPlotAreaPixels($px_l, $py1, $pdx - $px_r, $py2);
$plot->SetXTitle('(1) Initial Range');
# Disable zero magnet and range adjustment:
$plot->TuneYAutoRange(0, 'R', 0);
$plot->DrawGraph();
# Sub-plot (2) shows the plot range after zero magnet.
$plot->SetPlotAreaPixels($pdx + $px_l, $py1, 2 * $pdx - $px_r, $py2);
$plot->SetXTitle('(2) Zero Magnet');
# Reset to auto-range, auto-axis:
$plot->SetPlotAreaWorld(NULL, NULL, NULL, NULL);
$plot->SetXAxisPosition(NULL);
# Set zero magnet on, leave range adjust off:
$plot->TuneYAutoRange(1, 'R', 0);
$plot->DrawGraph();
# Sub-plot (3) shows the plot range after end adjust / increase range.
$plot->SetPlotAreaPixels(2 * $pdx + $px_l, $py1, 3 * $pdx - $px_r, $py2);
示例11: PHPlot
break;
}
// 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);
示例12:
$p->SetPlotBorderType('full');
$p->SetLegend(array('Path A', 'Path B', 'Path C', 'Path D'));
switch ($legend_positioning) {
case 'world':
$p->SetLegendWorld(0.1, 35);
break;
case 'pixels':
$p->SetLegendPixels(50, 50);
break;
case 'plotrelative':
# This places the upper left corner of the legend box at an offset of
# (5,5) from the upper left corner of the plot area.
$p->SetLegendPosition(0, 0, 'plot', 0, 0, 5, 5);
break;
# No default: Default is to not position the legend and let it default.
}
# Draw n_across * n_down plots:
$plot_area_y1 = $plot_area_margin;
for ($iy = 0; $iy < $n_down; $iy++) {
$plot_area_x1 = $plot_area_margin;
$plot_area_y2 = $plot_area_y1 + $plot_area_height;
for ($ix = 0; $ix < $n_across; $ix++) {
$plot_area_x2 = $plot_area_x1 + $plot_area_width;
$p->SetPlotAreaPixels($plot_area_x1, $plot_area_y1, $plot_area_x2, $plot_area_y2);
$p->DrawGraph();
$plot_area_x1 = $plot_area_x2 + $plot_area_margin;
}
$plot_area_y1 = $plot_area_y2 + $plot_area_margin;
}
# Now output the completed image
$p->PrintImage();
示例13: array
# PHPlot test: Two plots on image with auto-scaling
require_once 'phplot.php';
$data1 = array(array('', 0, 10, 50), array('', 1, 20, 40), array('', 2, 30, 20), array('', 3, 40, 0));
$data2 = array(array('', 0, 10, 80), array('', 1, 20, 40), array('', 2, 90, 20), array('', 3, 40, 10), array('', 7, 50, 5), array('', 9, 0, 0));
$p = new PHPlot(800, 600);
$p->SetPrintImage(0);
// Do not output image until told
// First plot:
$p->SetDataValues($data1);
$p->SetDataType('data-data');
$p->SetPlotType('lines');
$p->SetTitle('Two plots with auto scaling');
$p->SetXTitle('X Axis Title 1');
$p->SetYTitle('Y Axis Title 1');
$p->SetXTickIncrement(0.5);
$p->SetPlotAreaPixels(50, 50, 350, 550);
$p->DrawGraph();
// Second plot:
$p->SetDataValues($data2);
$p->SetDataType('data-data');
$p->SetPlotType('lines');
$p->SetXTitle('X Axis Title 2');
$p->SetYTitle('Y Axis Title 2');
$p->SetXTickIncrement(NULL);
// Reset to auto tick calculation
$p->SetPlotAreaWorld();
// Resets scale to auto
$p->SetPlotAreaPixels(450, 50, 750, 550);
$p->DrawGraph();
// Now output the completed image
$p->PrintImage();
示例14: Title
$plot->SetFontTTF('title', $font, 14);
$plot->SetFontTTF('x_title', $font, 14);
$plot->SetFontTTF('y_title', $font, 10);
# Disable auto-output:
$plot->SetPrintImage(0);
$title = "Test {$n_plots} Plots with TTF Title (sequence {$title_sequence})";
$y1 = $title_space;
// Top of plot area
for ($i = 0; $i < $n_plots; $i++) {
if ($i == $title_sequence) {
$plot->SetTitle($title);
}
$y2 = $y1 + $height_of_each_plot;
// Bottom of plot area
# fwrite(STDERR, "Plot $i area: min=(80, $y1) : max=(740, $y2)\n");
$plot->SetPlotAreaPixels(80, $y1, 740, $y2);
$plot->SetDataType('text-data');
$plot->SetDataValues($report[$i]);
$plot->SetPlotAreaWorld(NULL, 0, NULL, $max_x);
$plot->SetDataColors(array('blue'));
$plot->SetXTickLabelPos('none');
$plot->SetXDataLabelPos('plotdown');
$plot->SetXTickPos('plotdown');
$plot->SetYTickIncrement(1);
$plot->SetXTitle("Chart {$i} X Values");
$plot->SetYTitle("Chart {$i} Y Values");
$plot->SetPlotType('bars');
$plot->DrawGraph();
$y1 = $y2 + $space_below_plots;
// Start next plot below last plot
}
示例15: array
<?php
# $Id: data_table.example2.php 999 2011-08-05 19:00:48Z lbayuk $
# phplot / contrib / data_table example 2: Line plot with data table on the side
require_once 'phplot.php';
require_once 'data_table.php';
$data = array();
for ($i = 0; $i < 20; $i++) {
$data[] = array('', $i, 2 * $i, $i * $i);
}
// The $settings array configures the data table:
$settings = array('headers' => array(NULL, 'X', '2Y', 'Y^2'), 'position' => array(640, 20), 'width' => 150, 'data' => $data, 'font' => 3);
$plot = new PHPlot(800, 600);
$plot->SetTitle('Line Plot with Data Table on Right Side');
$plot->SetDataValues($data);
$plot->SetDataType('data-data');
$plot->SetPlotType('linepoints');
$plot->SetPlotAreaPixels(NULL, NULL, 630, NULL);
$plot->SetCallback('draw_graph', 'draw_data_table', $settings);
$plot->SetLegend(array('2Y', 'Y^2'));
$plot->DrawGraph();