当前位置: 首页>>代码示例>>PHP>>正文


PHP Graph::SetScale方法代码示例

本文整理汇总了PHP中Amenadiel\JpGraph\Graph\Graph::SetScale方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::SetScale方法的具体用法?PHP Graph::SetScale怎么用?PHP Graph::SetScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Amenadiel\JpGraph\Graph\Graph的用法示例。


在下文中一共展示了Graph::SetScale方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

<?php

// content="text/plain; charset=utf-8"
// Basic contour plot example
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$data = array(array(12, 7, 3, 15), array(18, 5, 1, 9), array(13, 9, 5, 12), array(5, 3, 8, 9), array(1, 8, 5, 7));
// Basic contour graph
$graph = new Graph\Graph(350, 250);
$graph->SetScale('intint');
// Show axis on all sides
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
// Adjust the margins to fit the margin
$graph->SetMargin(30, 100, 40, 30);
// Setup
$graph->title->Set('Basic contour plot with multiple axis');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// A simple contour plot with default arguments (e.g. 10 isobar lines)
$cp = new Plot\ContourPlot($data, 10, 2);
// Display the legend
$cp->ShowLegend();
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();
开发者ID:amenadiel,项目名称:jpgraph,代码行数:25,代码来源:basic_contourex03-2.php

示例2: array

<?php

// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
// We need some data
$datay = array(4, 8, 6);
// Setup the graph.
$graph = new Graph\Graph(200, 150);
$graph->SetScale("textlin");
$graph->img->SetMargin(25, 15, 25, 25);
$graph->title->Set('"GRAD_CENTER"');
$graph->title->SetColor('darkred');
// Setup font for axis
$graph->xaxis->SetFont(FF_FONT1);
$graph->yaxis->SetFont(FF_FONT1);
// Create the bar pot
$bplot = new Plot\BarPlot($datay);
$bplot->SetWidth(0.6);
// Setup color for gradient fill style
$bplot->SetFillGradient("navy", "lightsteelblue", GRAD_CENTER);
// Set color for the frame of each bar
$bplot->SetColor("navy");
$graph->Add($bplot);
// Finally send the graph to the browser
$graph->Stroke();
开发者ID:amenadiel,项目名称:jpgraph,代码行数:27,代码来源:bargradsmallex7.php

示例3: array

<?php

// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
// Some data
$datay = array(7, 19, 11, 4, 20);
// Create the graph and setup the basic parameters
$graph = new Graph\Graph(300, 200, 'auto');
$graph->img->SetMargin(40, 30, 40, 50);
$graph->SetScale("textint");
$graph->SetFrame(true, 'blue', 1);
$graph->SetColor('lightblue');
$graph->SetMarginColor('lightblue');
// Setup X-axis labels
$a = $gDateLocale->GetShortMonth();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetFont(FF_FONT1);
$graph->xaxis->SetColor('darkblue', 'black');
// Setup "hidden" y-axis by given it the same color
// as the background (this could also be done by setting the weight
// to zero)
$graph->yaxis->SetColor('lightblue', 'darkblue');
$graph->ygrid->SetColor('white');
// Setup graph title ands fonts
$graph->title->Set('Using grace = 10%');
$graph->title->SetFont(FF_FONT2, FS_BOLD);
$graph->xaxis->SetTitle('Year 2002', 'center');
$graph->xaxis->SetTitleMargin(10);
$graph->xaxis->title->SetFont(FF_FONT2, FS_BOLD);
开发者ID:amenadiel,项目名称:jpgraph,代码行数:31,代码来源:grace_ex1.php

示例4: array

<?php

// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$datay = array(10, 29, 3, 6);
// Create the graph.
$graph = new Graph\Graph(200, 200);
$graph->SetScale('textlin');
$graph->SetMargin(25, 10, 20, 25);
$graph->SetBox(true);
// Add 10% grace ("space") at top and botton of Y-scale.
$graph->yscale->SetGrace(10);
// Create a bar pot
$bplot = new Plot\BarPlot($datay);
$bplot->SetFillColor("lightblue");
$graph->ygrid->Show(false);
// .. and add the plot to the graph
$graph->Add($bplot);
// Add band
$band = new Plot\PlotBand(HORIZONTAL, BAND_3DPLANE, 15, 35, 'khaki4');
$band->SetDensity(40);
$band->ShowFrame(true);
$graph->AddBand($band);
// Set title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->SetColor('darkred');
$graph->title->Set('BAND_3DPLANE, Density=40');
$graph->Stroke();
开发者ID:amenadiel,项目名称:jpgraph,代码行数:30,代码来源:plotbanddensity_ex1.php

示例5: array

<?php

// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$ydata = array(12, 19, 3, 9, 15, 10);
// The code to setup a very basic graph
$graph = new Graph\Graph(200, 150);
$graph->SetScale('intlin');
$graph->SetMargin(30, 15, 40, 30);
$graph->SetMarginColor('white');
$graph->SetFrame(true, 'blue', 3);
$graph->title->Set('Label background');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->subtitle->SetFont(FF_ARIAL, FS_NORMAL, 10);
$graph->subtitle->SetColor('darkred');
$graph->subtitle->Set('"LABELBKG_YAXIS"');
$graph->SetAxisLabelBackground(LABELBKG_YAXIS, 'orange', 'red', 'lightblue', 'red');
// Use Ariel font
$graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 9);
$graph->yaxis->SetFont(FF_ARIAL, FS_NORMAL, 9);
$graph->xgrid->Show();
// Create the plot line
$p1 = new Plot\LinePlot($ydata);
$graph->Add($p1);
// Output graph
$graph->Stroke();
开发者ID:amenadiel,项目名称:jpgraph,代码行数:28,代码来源:axislabelbkgex03.php

示例6: array

<?php

// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
require_once 'jpgraph/jpgraph_log.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$ydata = array(11, 3, 8, 42, 5, 1, 9, 13, 5, 7);
$datax = array("Jan", "Feb", "Mar", "Apr", "Maj", "Jun", "Jul", "aug", "Sep", "Oct");
// Create the graph. These two calls are always required
$graph = new Graph\Graph(350, 200);
$graph->SetScale("textlog");
$graph->img->SetMargin(40, 110, 20, 40);
$graph->SetShadow();
$graph->ygrid->Show(true, true);
$graph->xgrid->Show(true, false);
// Specify the tick labels
$a = $gDateLocale->GetShortMonth();
$graph->xaxis->SetTickLabels($a);
// Create the linear plot
$lineplot = new Plot\LinePlot($ydata);
// Add the plot to the graph
$graph->Add($lineplot);
$graph->title->Set("Examples 9");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$lineplot->SetColor("blue");
$lineplot->SetWeight(2);
开发者ID:amenadiel,项目名称:jpgraph,代码行数:31,代码来源:example9.php

示例7: array

require_once 'jpgraph/jpgraph_utils.inc.php';
// Create some "fake" regression data
$datay = array();
$datax = array();
$a = 3.2;
$b = 2.5;
for ($x = 0; $x < 20; ++$x) {
    $datax[$x] = $x;
    $datay[$x] = $a + $b * $x + rand(-20, 20);
}
$lr = new LinearRegression($datax, $datay);
list($stderr, $corr) = $lr->GetStat();
list($xd, $yd) = $lr->GetY(0, 19);
// Create the graph
$graph = new Graph\Graph(300, 250);
$graph->SetScale('linlin');
// Setup title
$graph->title->Set("Linear regression");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 14);
$graph->subtitle->Set('(stderr=' . sprintf('%.2f', $stderr) . ', corr=' . sprintf('%.2f', $corr) . ')');
$graph->subtitle->SetFont(FF_ARIAL, FS_NORMAL, 12);
// make sure that the X-axis is always at the
// bottom at the plot and not just at Y=0 which is
// the default position
$graph->xaxis->SetPos('min');
// Create the scatter plot with some nice colors
$sp1 = new ScatterPlot($datay, $datax);
$sp1->mark->SetType(MARK_FILLEDCIRCLE);
$sp1->mark->SetFillColor("red");
$sp1->SetColor("blue");
$sp1->SetWeight(3);
开发者ID:amenadiel,项目名称:jpgraph,代码行数:31,代码来源:example16.6.php

示例8: array

// content="text/plain; charset=utf-8"
// Contour example 05
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$data = array(array(0.0, 0.001, 0.002, 0.005, -0.003, -0.053, -0.156, -0.245, -0.235, -0.143, -0.056, -0.014, -0.002, 0.0, 0.0), array(0.0, 0.002, 0.008999999999999999, 0.015, -0.04, -0.308, -0.826, -1.257, -1.188, -0.719, -0.28, -0.07000000000000001, -0.011, -0.001, 0.0), array(0.001, 0.005, 0.024, 0.047, -0.103, -0.878, -2.432, -3.767, -3.591, -2.166, -0.828, -0.195, -0.026, -0.001, 0.0), array(0.001, 0.007, 0.046, 0.145, 0.096, -0.913, -3.472, -6.042, -6.038, -3.625, -1.283, -0.235, -0.005, 0.007, 0.002), array(-0.003, -0.008999999999999999, 0.008999999999999999, 0.208, 0.734, 0.864, -0.9370000000000001, -3.985, -4.866, -2.781, -0.5600000000000001, 0.194, 0.151, 0.043, 0.007), array(-0.013, -0.07199999999999999, -0.229, -0.259, 0.652, 2.587, 3.058, 0.661, -1.097, 0.014, 1.336, 1.154, 0.474, 0.113, 0.017), array(-0.028, -0.171, -0.653, -1.397, -1.091, 1.421, 3.424, 1.942, 0.403, 1.784, 2.986, 2.12, 0.821, 0.191, 0.028), array(-0.037, -0.231, -0.9340000000000001, -2.255, -2.78, -0.699, 1.692, 0.981, 0.198, 2.199, 3.592, 2.515, 0.968, 0.225, 0.033), array(-0.031, -0.201, -0.829, -2.076, -2.82, -1.399, 0.61, 0.408, 0.122, 1.882, 3.004, 2.085, 0.8, 0.186, 0.027), array(-0.018, -0.115, -0.469, -1.133, -1.343, 0.011, 1.921, 2.256, 1.824, 2.115, 2.141, 1.312, 0.481, 0.11, 0.016), array(-0.007, -0.039, -0.13, -0.152, 0.5600000000000001, 2.77, 5.591, 6.719, 5.583, 3.646, 1.973, 0.832, 0.251, 0.052, 0.007), array(-0.001, -0.003, 0.024, 0.273, 1.297, 3.628, 6.515, 7.832, 6.517, 3.875, 1.69, 0.546, 0.13, 0.022, 0.003), array(0.0, 0.004, 0.036, 0.215, 0.837, 2.171, 3.809, 4.578, 3.81, 2.218, 0.913, 0.268, 0.056, 0.008, 0.001), array(0.0, 0.002, 0.014, 0.076, 0.284, 0.721, 1.257, 1.511, 1.257, 0.728, 0.294, 0.083, 0.017, 0.002, 0.0), array(0.0, 0.0, 0.003, 0.016, 0.057, 0.144, 0.25, 0.3, 0.25, 0.144, 0.058, 0.016, 0.003, 0.0, 0.0));
// Setup a basic graph context with some generous margins to be able
// to fit the legend
$graph = new Graph\Graph(480, 390);
$graph->SetMargin(40, 120, 60, 50);
$graph->title->Set("Contour plot, high contrast color");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->title->SetMargin(10);
// For contour plots it is custom to use a box style ofr the axis
$graph->SetScale('intint', 0, 56, 0, 56);
// Setup axis and grids
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
$graph->xgrid->Show(true);
$graph->ygrid->Show(true);
// A simple contour plot with 10 isobar lines and flipped Y-coordinates
// Make the data smoother by interpolate the original matrice by a factor of two
// which will make each grid cell half the original size
$cp = new Plot\ContourPlot($data, 10, 3);
$cp->UseHighContrastColor(true);
// Display the legend
$cp->ShowLegend();
// Make the isobar lines slightly thicker
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();
开发者ID:amenadiel,项目名称:jpgraph,代码行数:30,代码来源:contourex05.php

示例9: separator1000

use Amenadiel\JpGraph\Plot;
// Callback function for Y-scale to get 1000 separator on labels
function separator1000($aVal)
{
    return number_format($aVal);
}
function separator1000_usd($aVal)
{
    return '$' . number_format($aVal);
}
// Some data
$datay = array(120567, 134013, 192000, 87000);
// Create the graph and setup the basic parameters
$graph = new Graph\Graph(500, 300, 'auto');
$graph->img->SetMargin(80, 30, 30, 40);
$graph->SetScale('textint');
$graph->SetShadow();
$graph->SetFrame(false);
// No border around the graph
// Add some grace to the top so that the scale doesn't
// end exactly at the max value.
// The grace value is the percetage of additional scale
// value we add. Specifying 50 means that we add 50% of the
// max value
$graph->yaxis->scale->SetGrace(50);
$graph->yaxis->SetLabelFormatCallback('separator1000');
// Setup X-axis labels
$a = $gDateLocale->GetShortMonth();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetFont(FF_FONT2);
// Setup graph title ands fonts
开发者ID:amenadiel,项目名称:jpgraph,代码行数:31,代码来源:barscalecallbackex1.php


注:本文中的Amenadiel\JpGraph\Graph\Graph::SetScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。