本文整理汇总了PHP中PHPlot::SetMarginsPixels方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetMarginsPixels方法的具体用法?PHP PHPlot::SetMarginsPixels怎么用?PHP PHPlot::SetMarginsPixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetMarginsPixels方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$data2[] = array('', $data1[$i][1], ($data1[$i][2] + $data1[$i][3]) / 2);
}
$p = new PHPlot(800, 600);
$p->SetPrintImage(0);
// Do not output image until told
// First plot:
$p->SetDataValues($data1);
$p->SetDataType('text-data');
$p->SetPlotType('ohlc');
$p->SetPlotAreaWorld(NULL, 0);
// For Y to start at 0
$p->SetXTickPos('none');
$p->SetTitle('OHLC and Line Plot Overlay');
$p->SetXTitle('Date', 'plotdown');
$p->SetYTitle('Security Price', 'plotleft');
$p->SetDrawPlotAreaBackground(True);
$p->SetPlotBgColor('PeachPuff');
$p->SetMarginsPixels(50, 50, 50, 50);
$p->DrawGraph();
// Second plot:
$p->SetDrawPlotAreaBackground(False);
$p->SetDataValues($data2);
$p->SetDataType('text-data');
$p->SetPlotType('lines');
$p->SetDataColors(array('red', 'orange'));
// Must clear X and Y titles or they are drawn again, possibly with offset.
$p->SetXTitle('');
$p->SetYTitle('');
$p->DrawGraph();
// Now output the completed image
$p->PrintImage();
示例2: array
<?php
include DIR_WS_CLASSES . 'phplot.php';
$stats = array();
$banner_stats_query = tep_db_query("select dayofmonth(banners_history_date) as name, banners_shown as value, banners_clicked as dvalue from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $banner_id . "' and to_days(now()) - to_days(banners_history_date) < " . $days . " order by banners_history_date");
while ($banner_stats = tep_db_fetch_array($banner_stats_query)) {
$stats[] = array($banner_stats['name'], $banner_stats['value'], $banner_stats['dvalue']);
}
if (sizeof($stats) < 1) {
$stats = array(array(date('j'), 0, 0));
}
$graph = new PHPlot(200, 220, 'images/graphs/banner_infobox-' . $banner_id . '.' . $banner_extension);
$graph->SetFileFormat($banner_extension);
$graph->SetIsInline(1);
$graph->SetPrintImage(0);
$graph->draw_vert_ticks = 0;
$graph->SetSkipBottomTick(1);
$graph->SetDrawXDataLabels(0);
$graph->SetDrawYGrid(0);
$graph->SetPlotType('bars');
$graph->SetDrawDataLabels(1);
$graph->SetLabelScalePosition(1);
$graph->SetMarginsPixels(15, 15, 15, 30);
$graph->SetTitleFontSize('4');
$graph->SetTitle('TEXT_BANNERS_LAST_3_DAYS');
$graph->SetDataValues($stats);
$graph->SetDataColors(array('blue', 'red'), array('blue', 'red'));
$graph->DrawGraph();
$graph->PrintImage();
示例3: PHPlot
<?php
//Include the code
include "../phplot.php";
//Define the object and get background image 0cars.jpg
//////NOTE! THIS EXAMPLE WILL ONLY WORK IF YOU HAVE
//////JPEG SUPPORT ENABLED. (Use a different file as a background
//////if you have png or gif enabled.
$graph = new PHPlot(500, 223, "", "0cars.jpg");
//Set some data
$example_data = array(array("55", 5), array("60", 10), array("65", 20), array("70", 30), array("75", 25), array("80", 10));
$graph->SetDataValues($example_data);
//Set up some nice formatting things
$graph->SetTitle("Speed Histogram");
$graph->SetXLabel("Miles per Hour");
$graph->SetYLabel("Percent of Cars");
$graph->SetVertTickIncrement(5);
$graph->SetPlotAreaWorld(0, 0, 6, 35);
//Make the margins nice for the background image
$graph->SetMarginsPixels(80, 35, 35, 70);
//Set up some color and printing options
$graph->background_done = 1;
//The image background we get from 0cars.jpg
$graph->SetDrawPlotAreaBackground(0);
//Plot Area background we get from the image
$graph->SetDataColors(array("white"), array("black"));
//Set Output format
$graph->SetFileFormat("png");
//Draw it
$graph->DrawGraph();
示例4: PHPlot
<?php
require 'phplot/phplot.php';
require 'mem_image.php';
$graph = new PHPlot(500, 300);
$graph->SetDataType('data-data');
//Specify some data
$data = array(array('', 2000, 750), array('', 2010, 1700), array('', 2015, 2000), array('', 2020, 1800), array('', 2025, 1300), array('', 2030, 400));
$graph->SetDataValues($data);
//Specify plotting area details
$graph->SetPlotType('lines');
$graph->SetTitleFontSize('2');
$graph->SetTitle('Social Security trust fund asset estimates, in $ billions');
$graph->SetMarginsPixels(null, null, 40, null);
$graph->SetPlotAreaWorld(2000, 0, 2035, 2000);
$graph->SetPlotBgColor('white');
$graph->SetPlotBorderType('left');
$graph->SetBackgroundColor('white');
$graph->SetDataColors(array('red'), array('black'));
//Define the X axis
$graph->SetXLabel('Year');
$graph->SetXTickIncrement(5);
//Define the Y axis
$graph->SetYTickIncrement(500);
$graph->SetPrecisionY(0);
$graph->SetLightGridColor('blue');
//Disable image output
$graph->SetPrintImage(false);
//Draw the graph
$graph->DrawGraph();
$pdf = new PDF_MemImage();
示例5: marks
$plot->SetImageBorderType('plain');
// For presentation in the manual
$plot->SetTitle('Hourly Data Example Plot');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
$plot->SetPlotType('lines');
# Make the X tick marks (and therefore X grid lines) 24 hours apart:
$plot->SetXTickIncrement(60 * 60 * 24);
$plot->SetDrawXGrid(True);
# Anchor the X tick marks at midnight. This makes the X grid lines act as
# separators between days of the week, regardless of the starting hour.
# (Except this messes up around daylight saving time changes.)
$plot->SetXTickAnchor($tick_anchor);
# We want both X axis data labels and X tick labels displayed. They will
# be positioned in a way that prevents them from overwriting.
$plot->SetXDataLabelPos('plotdown');
$plot->SetXTickLabelPos('plotdown');
# Increase the left and right margins to leave room for weekday labels.
$plot->SetMarginsPixels(50, 50);
# Tick labels will be formatted as date/times, showing the date:
$plot->SetXLabelType('time', '%Y-%m-%d');
# ... but then we must reset the data label formatting to no formatting.
$plot->SetXDataLabelType('');
# Show tick labels (with dates) at 90 degrees, to fit between the data labels.
$plot->SetXLabelAngle(90);
# ... but then we must reset the data labels to 0 degrees.
$plot->SetXDataLabelAngle(0);
# Force the Y range to 0:100.
$plot->SetPlotAreaWorld(NULL, 0, NULL, 100);
# Now draw the graph:
$plot->DrawGraph();
示例6: array
# These parameters control the cases. They can be set in a calling script:
# $reset_plot_area_background = TRUE;
# $reset_image_background = TRUE;
require_once 'phplot.php';
# Create the title string:
$title = "Background Image Reset Test\n" . "Image background is " . (empty($reset_image_background) ? "on (set)\n" : "off (set and reset)\n") . "Plot area background is " . (empty($reset_plot_area_background) ? "on (set)\n" : "off (set and reset)\n");
# Use a bar graph because it is easier to see on the weird background.
$data = array(array('Jan', 1000), array('Feb', 2000), array('Mar', 3000), array('Apr', 2500), array('May', 1500), array('Jun', 500));
$plot = new PHPlot(800, 600);
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetTitle($title);
# Make a legend so we can see how the background behaves:
$plot->SetLegend(array('Widgets Produced'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
# Set Y range and tick interval:
$plot->SetPlotAreaWorld(NULL, 0, NULL, 4000);
$plot->SetYTickIncrement(500);
# Give it extra room around the plot area so we can see the backgrounds:
$plot->SetMarginsPixels(100, 100, 100, 100);
$plot->SetBgImage('images/clouds.jpg', 'scale');
if (!empty($reset_image_background)) {
$plot->SetBgImage(NULL);
}
$plot->SetPlotAreaBgImage('images/bubbles.png', 'tile');
if (!empty($reset_plot_area_background)) {
$plot->SetPlotAreaBgImage(NULL);
}
$plot->DrawGraph();
示例7: PHPlot
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);
//New Plot Area
$graph->SetLegend(array('Size of Dog'));
示例8: array
# case 2 : Hide Y axis only
# case 3 : Hide X and Y axis lines
# case 4 : Hide X and Y axis lines and maximize plot area usage.
if (!isset($case)) {
$case = 0;
}
$data = array(array('A', 1, 2), array('B', 2, 3), array('C', 3, 4), array('D', 4, 3), array('E', 3, 1));
$p = new PHPlot();
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetTitle("Test axis suppression - case {$case}");
$p->SetXTickPos('none');
$p->SetXTickLabelPos('none');
$p->SetXDataLabelPos('none');
$p->SetYTickPos('none');
$p->SetYTickLabelPos('none');
$p->SetPlotBorderType('none');
$p->SetDrawXGrid(False);
$p->SetDrawYGrid(False);
if ($case == 1 || $case == 3 || $case == 4) {
$p->SetDrawXAxis(FALSE);
}
if ($case == 2 || $case == 3 || $case == 4) {
$p->SetDrawYAxis(FALSE);
}
if ($case == 4) {
$p->SetMarginsPixels(2, 2, 2, 2);
}
// L R T B
$p->DrawGraph();
示例9: 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();
示例10:
// Defer output until the end
$plot->SetTitle($title);
$plot->SetPlotBgColor('gray');
$plot->SetLightGridColor('black');
// So grid stands out from background
# Plot 1
$plot->SetDrawPlotAreaBackground(True);
$plot->SetPlotType('stackedbars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data1);
$plot->SetYTitle($y_title1);
# Set and position legend #1:
$plot->SetLegend($legend1);
$plot->SetLegendPixels(5, 30);
# Set margins to leave room for plot 2 Y title on the right.
$plot->SetMarginsPixels(120, 120);
# Specify Y range of these data sets:
$plot->SetPlotAreaWorld(NULL, 0, NULL, 5000);
$plot->SetYTickIncrement(500);
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
# Format Y tick labels as integers, with thousands separator:
$plot->SetYLabelType('data', 0);
$plot->DrawGraph();
# Plot 2
$plot->SetDrawPlotAreaBackground(False);
// Cancel background
$plot->SetDrawYGrid(False);
// Cancel grid, already drawn
$plot->SetPlotType('linepoints');
$plot->SetDataValues($data2);
示例11: Control
// Tells test suite to skip this test
}
$title = 'Legend Text & Background Color Control (' . ($use_shapes ? 'marker shapes' : 'color boxes') . ')' . "\n" . "\nImage background color: " . ifset($image_bg_color) . "\nPlot area background color: " . ifset($plot_bg_color) . "\nLegend background color: " . ifset($legend_bg_color) . "\nLegend text color: " . ifset($legend_text_color) . "\nGeneral text color: " . ifset($text_color);
$data = array(array('', 1, 1, 2, 3, 4, 5), array('', 2, 5, 1, 2, 3, 4), array('', 3, 4, 5, 1, 2, 3), array('', 4, 3, 4, 5, 1, 2), array('', 5, 2, 3, 4, 5, 1));
# Random legend lines, different lengths
$legend = array('Data set 1', 'Data set 2', 'Error', 'Difference', 'Alternate');
$p = new PHPlot(800, 600);
$p->SetTitle($title);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('points');
$p->SetLegend($legend);
$p->SetPlotAreaWorld(0, 0, 6, 6);
$p->SetPointSizes(8);
# Wide left margin, leaving room for legend:
$p->SetMarginsPixels(200);
# Put the legend to the left of plot area, starting about 1/4 down:
$p->SetLegendPosition(1, 0, 'plot', -0.1, 0.25);
# Colors:
if (!empty($image_bg_color)) {
$p->SetBackgroundColor($image_bg_color);
}
if (!empty($plot_bg_color)) {
$p->SetPlotBgColor($plot_bg_color);
$p->SetDrawPlotAreaBackground(True);
}
if (!empty($legend_bg_color)) {
$p->SetLegendBgColor($legend_bg_color);
}
$p->SetLegendUseShapes($use_shapes);
if (!empty($text_color)) {
示例12: list
$p->SetXDataLabelPos($tp['xdatalabel']);
} else {
$p->SetXTickLabelPos($tp['xticklabel']);
}
if (isset($tp['xtick'])) {
$p->SetXTickPos($tp['xtick']);
} else {
$p->SetXTickPos($tp['xticklabel']);
}
$p->SetYTickLabelPos($tp['yticklabel']);
if (isset($tp['ytick'])) {
$p->SetYTickPos($tp['ytick']);
} else {
$p->SetYTickPos($tp['yticklabel']);
}
if (isset($tp['xticklen'])) {
$p->SetXTickLength($tp['xticklen']);
}
if (isset($tp['yticklen'])) {
$p->SetYTickLength($tp['yticklen']);
}
# If there are values of x<0, move the Y axis to X=0
if ($tp['xlt0']) {
$p->SetYAxisPosition(0);
}
if (isset($tp['margins'])) {
list($top, $right, $bottom, $left) = $tp['margins'];
$p->SetMarginsPixels($left, $right, $top, $bottom);
}
$p->SetPlotType('linepoints');
$p->DrawGraph();
示例13: array
$title = utf8_decode($title);
}
$lbl_success = $I18N->Msg('a587_stats_rate_success_failure_lblsuccess');
if (rex_lang_is_utf8()) {
$lbl_success = utf8_decode($lbl_success);
}
$lbl_miss = $I18N->Msg('a587_stats_rate_success_failure_lblmiss');
if (rex_lang_is_utf8()) {
$lbl_miss = utf8_decode($lbl_miss);
}
$data = array(array('', $successCount, $missCount, '', ''));
// draw image
$plot = new PHPlot(350, 240);
$plot->SetImageBorderType('none');
$plot->SetTransparentColor('white');
$plot->SetMarginsPixels(NULL, NULL, 40, NULL);
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetDataColors(array('#2c8ce0', '#14568a'));
$plot->SetShading(6);
# Main plot title:
$plot->SetTitle($title);
$plot->SetFont('title', 3);
$len = strlen('' . ($sum = $successCount + $missCount));
$plot->SetYTickIncrement(max(1, ceil($sum / pow(10, $len - 1)) * pow(10, $len - 2)));
# Make a legend for the 3 data sets plotted:
$plot->SetLegend(array($lbl_success . ': ' . $successCount, $lbl_miss . ': ' . $missCount));
$plot->SetLegendStyle('left', 'right');
# Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickLabelPos('none');
示例14: array
# this script. The parameters are shown in the defaults array below:
if (!isset($tp)) {
$tp = array();
}
$tp = array_merge(array('title' => 'Partial Margin Specification Test', 'suffix' => '', 'doSetMarginsPixels' => False, 'MarginsPixels' => array(NULL, NULL, NULL, NULL), 'doSetPlotAreaPixels' => False, 'PlotAreaPixels' => array(NULL, NULL, NULL, NULL)), $tp);
require_once 'phplot.php';
$data = array(array('Jan', 100, 200, 300), array('Feb', 120, 190, 240), array('Mar', 130, 180, 290), array('Apr', 140, 170, 260), array('May', 120, 160, 200), array('Jun', 130, 150, 220));
define('PLOT_WIDTH', 1024);
define('PLOT_HEIGHT', 768);
$p = new PHPlot(1024, 768);
$p->SetTitle($tp['title'] . $tp['suffix']);
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetXTickLabelPos('none');
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(10.0);
$p->SetYTickPos('both');
$p->SetYTickLabelPos('both');
$p->SetDrawXGrid(False);
$p->SetDrawYGrid(True);
$p->SetXTitle("Two Line\nX Axis Title");
$p->SetYTitle("Three Line\nY Axis\nTitle");
$p->SetPlotAreaWorld(NULL, 0, NULL, NULL);
if ($tp['doSetMarginsPixels']) {
$p->SetMarginsPixels($tp['MarginsPixels'][0], $tp['MarginsPixels'][1], $tp['MarginsPixels'][2], $tp['MarginsPixels'][3]);
}
if ($tp['doSetPlotAreaPixels']) {
$p->SetPlotAreaPixels($tp['PlotAreaPixels'][0], $tp['PlotAreaPixels'][1], $tp['PlotAreaPixels'][2], $tp['PlotAreaPixels'][3]);
}
$p->DrawGraph();