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


PHP PHPlot::SetYTickIncrement方法代码示例

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


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

示例1: make_plot

function make_plot($plot_type, $data_type, $nx, $ny)
{
    $plot = new PHPlot(1280, 1024);
    $plot->SetPrintImage(False);
    $plot->SetFailureImage(False);
    $plot->SetDataType($data_type);
    $plot->SetDataValues(make_data_array($plot_type, $data_type, $nx, $ny, 100));
    $plot->SetPlotType($plot_type);
    $plot->SetTitle("Serialize/Unserialize Tests\n{$plot_type} - {$data_type}");
    $plot->SetXTickIncrement(5);
    $plot->SetYTickIncrement(10);
    $plot->SetPlotBorderType('full');
    $plot->SetDrawXGrid(True);
    $plot->SetDrawYGrid(True);
    $plot->SetXTitle('X Axis Title');
    $plot->SetYTitle('Y Axis Title');
    # Select data labels or tick labels based on data type:
    if ($data_type == 'data-data') {
        $plot->SetXDataLabelPos('none');
        $plot->SetXTickLabelPos('plotdown');
        $plot->SetXTickPos('plotdown');
    } elseif ($data_type == 'text-data') {
        $plot->SetXDataLabelPos('plotdown');
        $plot->SetXTickLabelPos('none');
        $plot->SetXTickPos('none');
    } elseif ($data_type == 'data-data-yx') {
        $plot->SetYDataLabelPos('none');
        $plot->SetYTickLabelPos('plotleft');
        $plot->SetYTickPos('plotleft');
    } elseif ($data_type == 'text-data-yx') {
        $plot->SetYDataLabelPos('plotleft');
        $plot->SetYTickLabelPos('none');
        $plot->SetYTickPos('none');
    }
    return $plot;
}
开发者ID:myfarms,项目名称:PHPlot,代码行数:36,代码来源:serialize1.php

示例2: 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();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:lines2.php

示例3:

$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);
# Set Y title for plot #2 and position it on the right side:
$plot->SetYTitle($y_title2, 'plotright');
# Set and position legend #2:
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:outbreak.php

示例4: elseif

if ($tp['use_ttf']) {
    if (isset($tp['legendfont'])) {
        $p->SetFont('legend', $tp['legendfont'], $tp['ttfsize']);
    } else {
        $p->SetFont('legend', $tp['ttfont'], $tp['ttfsize']);
    }
} elseif (isset($tp['legendfont'])) {
    $p->SetFont('legend', $tp['legendfont']);
}
$p->SetLegend($tp['text']);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('lines');
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(1.0);
if (isset($tp['textalign'])) {
    if (isset($tp['colorboxalign'])) {
        $p->SetLegendStyle($tp['textalign'], $tp['colorboxalign']);
    } else {
        $p->SetLegendStyle($tp['textalign']);
    }
}
if (isset($tp['px']) && isset($tp['py'])) {
    $p->SetLegendPixels($tp['px'], $tp['py']);
}
if (isset($tp['wx']) && isset($tp['wy'])) {
    $p->SetLegendWorld($tp['wx'], $tp['wy']);
}
if (isset($tp['cbwa'])) {
    $p->legend_colorbox_width = $tp['cbwa'];
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:legend_--.php

示例5: prif

# Printing helper
function prif($name, &$var, $before = '')
{
    return "{$before} {$name}=" . (isset($var) ? $var : "n/a");
}
# Auto title:
$title = 'X/Y Tick Anchors' . (empty($subtitle) ? "\n" : " - {$subtitle}\n") . prif('X tick anchor', $x_tick_anchor) . prif('Y tick anchor', $y_tick_anchor, ',') . prif('X tick inc.', $x_tick_step, ',') . prif('Y tick inc.', $y_tick_step, ',');
$data = array();
for ($x = $start; $x <= $stop; $x += $delta) {
    $data[] = array('', $x, $x);
}
$plot = new PHPlot(800, 600);
$plot->SetTitle($title);
$plot->SetPlotType('lines');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
if (isset($x_tick_step)) {
    $plot->SetXTickIncrement($x_tick_step);
}
if (isset($y_tick_step)) {
    $plot->SetYTickIncrement($y_tick_step);
}
if (isset($x_tick_anchor)) {
    $plot->SetXTickAnchor($x_tick_anchor);
}
if (isset($y_tick_anchor)) {
    $plot->SetYTickAnchor($y_tick_anchor);
}
$plot->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:tickanchor.php

示例6: 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();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:point-shapes.php

示例7: array

    $tp = array();
}
$tp = array_merge(array('c' => 10, 't' => 1, 'ar' => FALSE), $tp);
require_once 'phplot.php';
# Extract all test parameters as local variables:
extract($tp);
$title = "Log/Log Axis Test\nPlotting: XY = {$c}\n" . "Tick step: " . (empty($t) ? "Auto" : $t) . ", " . "Range: " . ($ar ? "Auto" : "Manually set");
# Plot X*Y=C
$data = array();
for ($x = 1; $x <= $c; $x++) {
    $data[] = array('', $x, $c / $x);
}
$p = new PHPlot(800, 600);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetTitle($title);
$p->SetXScaleType('log');
$p->SetYScaleType('log');
if (empty($t)) {
    $p->SetXTickIncrement($t);
    $p->SetYTickIncrement($t);
}
if (!$ar) {
    $p->SetPlotAreaWorld(0, 1, $c + 1, $c + 1);
}
$p->SetXTickAnchor(0);
$p->SetYTickAnchor(0);
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
$p->SetPlotType('lines');
$p->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:range-log.php

示例8: array

<?php

# PHPlot Example: Point chart with error bars
require_once 'phplot.php';
$data = array(array('', 1, 23.5, 5, 5), array('', 2, 20.1, 3, 3), array('', 3, 19.1, 2, 2), array('', 4, 16.8, 3, 3), array('', 5, 18.4, 4, 6), array('', 6, 20.5, 3, 2), array('', 7, 23.2, 4, 4), array('', 8, 23.1, 5, 2), array('', 9, 24.5, 2, 2), array('', 10, 28.1, 2, 2));
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('points');
$plot->SetDataType('data-data-error');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('Points Plot With Error Bars');
# Set data range and tick increments to get nice even numbers:
$plot->SetPlotAreaWorld(0, 0, 11, 40);
$plot->SetXTickIncrement(1);
$plot->SetYTickIncrement(5);
# Draw both grids:
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
# Is default
# Set some options for error bars:
$plot->SetErrorBarShape('tee');
# Is default
$plot->SetErrorBarSize(10);
$plot->SetErrorBarLineWidth(2);
# Use a darker color for the plot:
$plot->SetDataColors('brown');
$plot->SetErrorBarColors('brown');
# Make the points bigger so we can see them:
$plot->SetPointSizes(10);
$plot->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:points1.php

示例9: 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();
开发者ID:myfarms,项目名称:PHPlot,代码行数:29,代码来源:labelformats2.php

示例10: 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();
}
开发者ID:itorres,项目名称:drupal-guifi,代码行数:100,代码来源:guifi_cnml.inc.php

示例11: draw

	/**
	 * Adds raw image data of the graph to the output.
	 * @param $opts FormOptions
	 */
	public function draw( FormOptions $opts ) {
		global $wgTranslatePHPlotFont, $wgLang;

		$width = $opts->getValue( 'width' );
		$height = $opts->getValue( 'height' );
		// Define the object
		$plot = new PHPlot( $width, $height );

		list( $legend, $resData ) = $this->getData( $opts );
		$count = count( $resData );
		$skip = intval( $count / ( $width / 60 ) - 1 );
		$i = $count;

		foreach ( $resData as $date => $edits ) {
			if ( $skip > 0 ) {
				if ( ( $count - $i ) % $skip !== 0 ) $date = '';
			}

			if ( strpos( $date, ';' ) !== false ) {
				list( , $date ) = explode( ';', $date, 2 );
			}

			array_unshift( $edits, $date );
			$data[] = $edits;
			$i--;
		}

		$font = FCFontFinder::find( $wgLang->getCode() );

		if ( $font ) {
			$plot->SetDefaultTTFont( $font );
		} else {
			$plot->SetDefaultTTFont( $wgTranslatePHPlotFont );
		}
		$plot->SetDataValues( $data );

		if ( $legend !== null ) {
			$plot->SetLegend( $legend );
		}

		$numberFont = FCFontFinder::find( 'en' );

		$plot->setFont( 'x_label', $numberFont, 8 );
		$plot->setFont( 'y_label', $numberFont, 8 );

		$yTitle = wfMsg( 'translate-stats-' . $opts['count'] );

		// Turn off X axis ticks and labels because they get in the way:
		$plot->SetYTitle( $yTitle );
		$plot->SetXTickLabelPos( 'none' );
		$plot->SetXTickPos( 'none' );
		$plot->SetXLabelAngle( 45 );


		$max = max( array_map( 'max', $resData ) );
		$max = self::roundToSignificant( $max, 1 );
		$max = round( $max, intval( -log( $max, 10 ) ) );

		$yTick = 10;
		while ( $max / $yTick > $height / 20 ) {
			$yTick *= 2;
		}

		// If we have very small case, ensure that there is at least one tick
		$yTick = min( $max, $yTick );
		$yTick = self::roundToSignificant( $yTick );
		$plot->SetYTickIncrement( $yTick );
		$plot->SetPlotAreaWorld( null, 0, null, $max );


		$plot->SetTransparentColor( 'white' );
		$plot->SetBackgroundColor( 'white' );

		// Draw it
		$plot->DrawGraph();
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:80,代码来源:SpecialTranslationStats.php

示例12: 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();
开发者ID:olien,项目名称:rexsearch,代码行数:31,代码来源:searchterm_timestats.inc.php

示例13:

 // plotup, plotdown, both, none
 if ($stat['ytitle']) {
     $graph->SetYTitle($stat['ytitle'], 'plotleft');
 }
 // plotleft, plotright, both, plotin, none
 // Remember that angles other than 90 are taken as 0 when working with fixed fonts.
 if (isset($stat['x_label_angle'])) {
     $graph->SetXLabelAngle($stat['x_label_angle']);
 } else {
     $graph->SetXLabelAngle(0);
 }
 $graph->SetYLabelAngle(0);
 if (!(isset($stat['tick_increment_y']) && $stat['tick_increment_y'])) {
     $stat['tick_increment_y'] = stats__get_y_increment($stat['data']);
 }
 $graph->SetYTickIncrement($stat['tick_increment_y']);
 $graph->SetXTickLabelPos('plotdown');
 // plotup, plotdown, both, xaxis, none
 $graph->SetYTickLabelPos('both');
 // plotleft, plotright, both, yaxis, none
 $graph->SetXTickPos('plotdown');
 // plotup, plotdown, both, xaxis, none
 $graph->SetYTickPos('both');
 // plotleft, plotright, both, yaxis, none
 //Set some data
 if ($stat['reverse_data']) {
     $data = array_reverse($stat['data']);
 } else {
     $data = $stat['data'];
 }
 $graph->SetDataValues($data);
开发者ID:danorama,项目名称:orsee,代码行数:31,代码来源:statistics_graph.php

示例14: PHPlot

<?php

include "./data_date2.php";
include "../phplot.php";
$graph = new PHPlot(600, 400);
$graph->SetPrintImage(0);
//Don't draw the image yet
$graph->SetDataType("data-data-error");
//Must be called before SetDataValues
$graph->SetNewPlotAreaPixels(90, 40, 540, 190);
$graph->SetDataValues($example_data);
$graph->SetXLabelType("time");
$graph->SetXLabelAngle(90);
$graph->SetXTitle("");
$graph->SetYTitle("Price");
$graph->SetYTickIncrement(20);
$graph->SetXTickIncrement(2679000);
$graph->SetXTimeFormat("%b %y");
$graph->SetPlotType("lines");
$graph->SetErrorBarShape("line");
$graph->SetPointShape("halfline");
$graph->SetYScaleType("log");
$graph->SetLineWidths(array(1));
$graph->SetPlotAreaWorld(883634400, 1, 915095000, 140);
$graph->SetXDataLabelPos('none');
$graph->DrawGraph();
//Now do the second chart on the image
unset($example_data);
$graph->SetYScaleType("linear");
include "./data_date.php";
$graph->SetDataType("data-data");
开发者ID:innomatic-libs,项目名称:phplotlib,代码行数:31,代码来源:example8.php

示例15: do_graph

/**
 * drawing the graph for a evaluation question
 *
 * @param array() $data
 * @param string $evalquestion_id
 */
function do_graph($data, $evalquestion_id)
{
    global $tmp_path_export, $auth, $PATH_EXPORT;
    $type = do_graph_template();
    //Define the object
    if ($type == "pie") {
        // Beim pie muss die Zeichenflaeche etwas groesser gewaehlt werden...
        $graph = new PHPlot(500, 300);
    } else {
        $graph = new PHPlot(300, 250);
    }
    if ($type == "pie") {
        // Beim pie muss das Array umgeformt werden. Bug in PHPlot?
        $tmp = array();
        $tmp2 = array();
        $legend = array();
        array_push($tmp, "Test");
        foreach ($data as $k => $d) {
            array_push($tmp, $d[1]);
            array_push($legend, $d[0]);
        }
        array_push($tmp2, $tmp);
        $data = $tmp2;
        $graph->SetLegend($legend);
    }
    //Data Colors
    $graph->SetDataColors(array("blue", "green", "yellow", "red", "PeachPuff", "orange", "pink", "lavender", "navy", "peru", "salmon", "maroon", "magenta", "orchid", "ivory"), array("black"));
    $max_x = max(array_map('next', $data));
    $graph->SetPlotAreaWorld(NULL, 0);
    // y-achse bei 0 starten
    $graph->SetPrecisionY(0);
    //anzahl kommastellen y-achse
    $graph->SetYTickIncrement($max_x < 10 ? 1 : round($max_x / 10));
    $graph->SetPlotBgColor(array(222, 222, 222));
    $graph->SetDataType("text-data");
    $graph->SetFileFormat(Config::get()->EVAL_AUSWERTUNG_GRAPH_FORMAT);
    $graph->SetOutputFile($tmp_path_export . "/evalsum" . $evalquestion_id . $auth->auth["uid"] . "." . Config::get()->EVAL_AUSWERTUNG_GRAPH_FORMAT);
    $graph->SetIsInline(true);
    $graph->SetDataValues($data);
    $graph->SetPlotType($type);
    $graph->SetXLabelAngle(count($data) < 10 ? 0 : 90);
    //$graph->SetShading(0); // kein 3D
    $graph->SetLineWidth(1);
    $graph->SetDrawXDataLabels(true);
    //Draw it
    $graph->DrawGraph();
}
开发者ID:ratbird,项目名称:hope,代码行数:53,代码来源:eval_summary.php


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